Namespaces
Variants

std::jthread:: ~jthread

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
~jthread ( ) ;
(C++20부터)

jthread 객체를 파괴합니다.

만약 * this 가 연결된 스레드를 가지고 있다면 ( joinable ( ) == true ), request_stop() 을 호출하고 그 다음 join() 을 호출합니다.

참고 사항

request_stop() jthread 가 이전에 중지 요청된 경우 아무런 효과가 없습니다.

A jthread 객체는 이후에 연관된 스레드를 가지지 않습니다

  • 기본 생성되었습니다.
  • 이동되었습니다.
  • join() 이 호출되었습니다.
  • detach() 이 호출되었습니다.

만약 join() 이 예외를 발생시키면 (예: 데드락이 감지된 경우), std::terminate() 이 호출될 수 있습니다.

예제

참고 항목

스레드 객체를 파괴하며, 기본 스레드는 반드시 조인되거나 분리되어야 함
( std::thread 의 public 멤버 함수)