[thread] thread.join() throws in 1.52.0

Hi, after updating from 1.51.0 to 1.52.0 call to a thread::join() throws "invalid_argument" / not joinable. I see that there is a change with regards to thread d-tor in this version but I don't really understand if and why this is related. Should joinable() be called now before every join()? -- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com

after updating from 1.51.0 to 1.52.0 call to a thread::join() throws "invalid_argument" / not joinable. I see that there is a change with regards to thread d-tor in this version but I don't really understand if and why this is related.
Should joinable() be called now before every join()?
Yes, you should check that the thread is joinable or ensure that BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is not defined. http://www.boost.org/doc/libs/1_52_0/doc/html/thread/thread_management.html#...

OK, clear. Thing is thread is actually being join()ed by
thread_group::join_all() which does not do the check. Is that a bug or I am
using it wrong now too?
2012/11/8 Igor R
after updating from 1.51.0 to 1.52.0 call to a thread::join() throws "invalid_argument" / not joinable. I see that there is a change with regards to thread d-tor in this version but I don't really understand if and why this is related.
Should joinable() be called now before every join()?
Yes, you should check that the thread is joinable or ensure that BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is not defined.
http://www.boost.org/doc/libs/1_52_0/doc/html/thread/thread_management.html#... _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com

Le 08/11/12 21:10, Szymon Gatner a écrit :
Not sure if it can be defined as a "bug", but thread_group definitely doesn't keep up with all the new thread features.
You are right. I have left thread_group a little bit on the road. Please, could you create a ticket? I will fix this very soon.
Understood. A question then: why did this thread became unjoinnable? It was never explicitly detached.
Please, could you post a short example that shows the issue? Thanks, Vicente

Le 08/11/12 19:28, Szymon Gatner a écrit :
Hi,
after updating from 1.51.0 to 1.52.0 call to a thread::join() throws "invalid_argument" / not joinable. I see that there is a change with regards to thread d-tor in this version but I don't really understand if and why this is related.
Should joinable() be called now before every join()?
Hi, join() requires that the threads is joinable, as there is only one thread owner the owner is able to know if the thread has been joined or not. See http://www.boost.org/doc/libs/1_51_0/doc/html/thread/thread_management.html#... Member function |join()| http://www.boost.org/doc/libs/1_51_0/doc/html/thread/thread_management.html#... void join(); Preconditions: the thread is joinable. Note that this requirement was already since 1.45, but the implementation didn't throw. Member function |join()| http://www.boost.org/doc/libs/1_45_0/doc/html/thread/thread_management.html#... void join(); Preconditions: |this->get_id()!=boost::this_thread::get_id()| This conforms with the C++11 standard. You can disable this by commenting this line in the Jamfile <define>BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED The idea was to not commit this line and let the user to define this macro. Sorry for the disturbance. Best, Vicente
participants (3)
-
Igor R
-
Szymon Gatner
-
Vicente J. Botet Escriba