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
의
public member function)
|