std::thread:: ~thread
From cppreference.net
C++
Concurrency support library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
~thread
(
)
;
|
(C++11以降) | |
スレッドオブジェクトを破棄します。
* this に関連付けられたスレッドがある場合( joinable ( ) == true )、 std:: terminate ( ) が呼び出されます。
注記
スレッドオブジェクトは、以下の場合に関連するスレッドを持たず(安全に破棄可能):
例
このコードを実行
#include <thread> using namespace std::chrono_literals; int main() { auto bleah = std::thread{[]{ std::this_thread::sleep_for(13ms); }}; } // ~thread calls std::terminate()
出力例:
terminate called without an active exception
関連項目
|
スレッドが結合可能な場合、停止要求が行われ、スレッドが結合される
(
std::jthread
の公開メンバ関数
)
|