Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

The C Standard, 7.2628.5.6 paragraph 2 [ISO/IEC 9899:20112024], states that a thread shall not be joined once it was previously joined or detached.

The termination of the other thread synchronizes with the completion of the thrd_join function. The thread identified by thr shall not have been previously detached or joined with another thread.

Similarly, subclause 7.2628.5.3 states that a paragraph 2 [ISO/IEC 9899:2024], states that a thread shall not be detached once it was previously joined or detached. 

The thrd_detach function tells the operating system to dispose of any resources allocated to the thread identified by thr when that thread terminates. The thread identified by thr shall not have been previously detached or joined with another thread.

Violating either of these subclauses results in in undefined behavior.

Noncompliant Code Example

...

Bibliography

[ISO/IEC 9899:20112024]

Subclause 7.2628.5.3, "The The thrd_detach Function"
Subclause 7.2628.5.6, "The The thrd_join Function"


...