This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

### 963. Various threading bugs #13

Section: 33.4.3.6 [thread.thread.member] Status: C++11 Submitter: Pete Becker Opened: 2009-01-07 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [thread.thread.member].

View all issues with C++11 status.

Discussion:

33.4.3.6 [thread.thread.member]: `thread::detach` is required to throw an exception if the thread is "not a detachable thread". "Detachable" is never defined.

[ Howard adds: ]

> Due to a mistake on my part, 3 proposed resolutions appeared at approximately the same time. They are all three noted below in the discussion.

[ Summit, proposed resolution: ]

> In 33.4.3.6 [thread.thread.member] change:

> >     void detach();

> > > ...

> > > -14- Error conditions:

> > > - `no_such_process` -- if the thread is not a valid thread.
> > > - `invalid_argument` -- if the thread is not a detachable joinable thread.

[ Post Summit, Jonathan Wakely adds: ]

> A `thread` is detachable if it is joinable. As we've defined joinable, we can just use that.

> This corresponds to the pthreads specification, where pthread_detach fails if the thread is not joinable:

> > EINVAL: The implementation has detected that the value specified by thread does not refer to a joinable thread.

> Jonathan recommends this proposed wording:

> > In 33.4.3.6 [thread.thread.member] change:

> > >     void detach();

> > > > ...

> > > > -14- Error conditions:

> > > > - ...
> > > > - `invalid_argument` -- not a detachable joinable thread.

[ Post Summit, Anthony Williams adds: ]

> This is covered by the precondition that `joinable()` be `true`.

> Anthony recommends this proposed wording:

> > In 33.4.3.6 [thread.thread.member] change:

> > >     void detach();

> > > > ...

> > > > -14- Error conditions:

> > > > - ...
> > > > - `invalid_argument` -- not a detachable thread.

[ 2009-10 Santa Cruz: ]

> Mark as Ready with proposed resolution from Summit.

Proposed resolution:

In 33.4.3.6 [thread.thread.member] change:

>     void detach();

> > ...

> > -14- Error conditions:

> > - `no_such_process` -- if the thread is not a valid thread.
> > - `invalid_argument` -- if the thread is not a detachable joinable thread.