Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] thread.join() throws in 1.52.0
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-11-08 15:14:05


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#thread.thread_management.thread.join

        Member function |join()|
        <http://www.boost.org/doc/libs/1_51_0/doc/html/thread/thread_management.html#thread.thread_management.thread.join>

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#thread.thread_management.thread.join>

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



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