|
Boost Users : |
Subject: Re: [Boost-users] Thread status
From: Jens Weller (JensWeller_at_[hidden])
Date: 2009-01-30 15:37:14
> Zeljko Vrba wrote:
> > On Fri, Jan 30, 2009 at 02:06:09PM +0000, Jens Luedicke wrote:
> >> how can I check if a given thread is runinng/finished/sleeping?
> >>
> > You can't. Even if you could, the information will most probably be
> wrong
> > by the time you get to use it. What is the actual problem you're trying
> to
> > solve?
> >
>
> I have three threads. Two of them are independent and they can run in
> parallel. The third thread depends on results returned by the first and
> second threads.
I guess thats to easy:
thread t1,t2,t3;
run 1 + 2
t1.join();
t2.join();
t3.run();
> Right now I use a condition variable to wait in the third thread until
> the first and second threads are finished (by checking two boolean
> variables that are set to true once the first and second threads
> finish).
>
> In a later scenario I may need to query those threads anytime to suspend
> or terminate them (the threads will run trajectory computations for a
> helicopter: takeoff, approach and cross-country flight).
>
> I was wondering if there is a boost-way to obtain state informations
> about a thread.
afaik you can send messages between threads, at least I do this a lot in wxWidgets, and boost offers with signal something similar I think.
regards,
Jens Weller
-- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net