Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-08-24 05:24:40


I think what you need is a condition variable and not join.
You can use notify_one and notify_all member of a common condition variable to wake up one or
respective all waiting threads:

http://www.boost.org/doc/html/condition.html

Please read this article in DDJ about boost threads there is written how to handle different
threading issues:
http://www.ddj.com/dept/cpp/184401518

With Kind Regards,

Ovanes Markarian

On Thu, August 24, 2006 09:05, Sascha Seewald wrote:
>
>
> Aubrey, Jason wrote:
>> Hi,
>>
>> Does anyone know the reason for the behavior in the following example
>> program?
>>
>> This example attempts to simulate the scenario where two threads wait on
>> a third thread. However, I realize that the following is actually one
>> thread waiting on a second thread twice.
>>
>> Regards,
>> Jason
>>
>> My Environment: MSVC 8.0, boost v1.33.1
>>
>> #include <boost/thread/thread.hpp>
>> #include <boost/thread/xtime.hpp>
>>
>> void f()
>> {
>> }
>>
>> void main()
>> {
>> boost::thread t(f);
>> t.join();
>> t.join(); // Causes an assertion
>
> A call to thread::join() requires the thread to be joinable. After the
> first call to join() the thread has finished and is not joinable anymore.
> If you'd like to execute f twice, create a seperate thread for each run.
>
> hth
>
> Sascha
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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