Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-11-06 09:26:51


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:
> 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
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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

With Kind Regards,

Ovanes Markarian


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