Re: [Boost-users] [Threads] Problem with starting a sub thread

Hi,
im trying to initiate a sub thread for checking some variables during the main program is running:
...do sth...
boost::thread checkT(&check); checkT.join();
...do sth...
As I understand boost::threads the second "do sth" should be performed during the thread is running. Well, it doesn't seem so. After experimenting some time it came up that starting two
Hi! join cause a calling thread to block until the second one is finished. This is also stated in the docs: 1.void join(); Requires: *this is joinable. !!!!!Effects: The current thread of execution blocks until the initial function of the thread of execution represented by *this finishes and all resources are reclaimed. Notes: If *this == thread() the result is implementation-defined. If the implementation doesn't detect this the result will be deadlock. There is a good article on boost threads at Dr.Dobbs site: http://www.ddj.com/dept/cpp/184401518 With Kind Regards, Ovanes Markarian On Mon, November 6, 2006 14:17, Torsten wrote: threads like that:
boost::thread checkT(&check); boost::thread stopCheckT(&stopCheck); checkT.join(); scheckT.join();
does work, but that:
boost::thread checkT(&check); checkT.join(); boost::thread stopCheckT(&stopCheck); scheckT.join();
does not. I really don't understand why. Either .join() stops executing the code (so the
scheckT.join() in the first example shouldn't be called) or it doesn't (than the second scheckT should be called too).
Where am I wrong? Has anybody an idea?
Torsten
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
With Kind Regards, Ovanes Markarian
participants (1)
-
Ovanes Markarian