Files
2025-10-25 03:02:53 +03:00

4.0 KiB
Raw Permalink Blame History

[thread.jthread.mem]

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;

1

#

Effects: Exchanges the values of *this and x.

🔗

bool joinable() const noexcept;

2

#

Returns: get_id() != id().

🔗

void join();

3

#

Effects: Blocks until the thread represented by *this has completed.

4

#

Synchronization: The completion of the thread represented by *this synchronizes with ([intro.multithread]) the corresponding successful join() return.

[Note 1:

Operations on *this are not synchronized.

— end note]

5

#

Postconditions: The thread represented by *this has completed.

get_id() == id().

6

#

Throws: system_error when an exception is required ([thread.req.exception]).

7

#

Error conditions:

  • (7.1)

    resource_deadlock_would_occur — if deadlock is detected orget_id() == this_thread::get_id().

  • (7.2)

    no_such_process — if the thread is not valid.

  • (7.3)

    invalid_argument — if the thread is not joinable.

🔗

void detach();

8

#

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.

9

#

Postconditions: get_id() == id().

10

#

Throws: system_error when an exception is required ([thread.req.exception]).

11

#

Error conditions:

  • (11.1)

    no_such_process — if the thread is not valid.

  • (11.2)

    invalid_argument — if the thread is not joinable.

🔗

id get_id() const noexcept;

12

#

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.