[thread.thread.destr]

# 32 Concurrency support library [[thread]](./#thread)

## 32.4 Threads [[thread.threads]](thread.threads#thread.thread.destr)

### 32.4.3 Class thread [[thread.thread.class]](thread.thread.class#thread.thread.destr)

#### 32.4.3.4 Destructor [thread.thread.destr]

[ð](#lib:thread,destructor)

`~thread();
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1742)

*Effects*: If joinable(), invokes terminate ([[except.terminate]](except.terminate "14.6.2 The std​::​terminate function"))[.](#1.sentence-1)

Otherwise, has no effects[.](#1.sentence-2)

[*Note [1](#note-1)*:

Either implicitly detaching or joining a joinable() thread in its
destructor can result in difficult to debug correctness (for detach) or performance
(for join) bugs encountered only when an exception is thrown[.](#1.sentence-3)

These bugs can be avoided by ensuring that
the destructor is never executed while the thread is still joinable[.](#1.sentence-4)

â *end note*]
