|
Boost : |
From: Eyal Farago (eyalfa_at_[hidden])
Date: 2002-04-10 06:29:31
I believe there is a problem with tread_gruop::join_all() and
thread::join().
the following code fragment will raise an assertion:
boost::thread_group tg;
tg.create_thread( ... )
...
tg.create_thread( ... )
tg.join_all()
tg.create_thread( ... )
...
tg.create_thread( ... )
tg.join_all() //this asserts false.
I believe there are two problems here:
1. join_all does'nt clean the inner list of threads, I believe that it
can't do it since calling create_thread() returns a thread* that the
client might refer to later.
2.thread::join() ignores the m_joinable member and attempts the actual
join operation even when it should'nt do so( i.e. default constructed
threads ). The first iteration of thread_group::join_all to attempt to
join all threads in the group including those already joined earlier,
this of course fails.
I believe that number 2 is the real problem here, and it can be solved
with a simple if like the destructor does, another solution would be
exposing a joinable() method that can be accessed before calling join().
By the way I'm working on win 2k, msvc6 sp 5.
Eyal.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk