[thread.jthread.mem] (original) (raw)
32 Concurrency support library [thread]
32.4 Threads [thread.threads]
32.4.4 Class jthread [thread.jthread.class]
32.4.4.3 Members [thread.jthread.mem]
void swap(jthread& x) noexcept;
Effects: Exchanges the values of *this and x.
bool joinable() const noexcept;
Returns: get_id() != id().
Effects: Blocks until the thread represented by *this has completed.
Synchronization: The completion of the thread represented by *thissynchronizes with ([intro.multithread]) the corresponding successful join() return.
[Note 1:
Operations on *this are not synchronized.
— _end note_]
Postconditions: The thread represented by *this has completed.
get_id() == id().
Error conditions:
- resource_deadlock_would_occur — if deadlock is detected orget_id() == this_thread::get_id().
- no_such_process — if the thread is not valid.
- invalid_argument — if the thread is not joinable.
Effects: The thread represented by *this continues execution without the calling thread blocking.
When detach() returns,*this no longer represents the possibly continuing thread of execution.
When the thread previously represented by *this ends execution, the implementation releases any owned resources.
Postconditions: get_id() == id().
Error conditions:
id get_id() const noexcept;
Returns: A default constructed id object if *this does not represent a thread, otherwise this_thread::get_id()for the thread of execution represented by *this.