thread_id (스레드 식별자)
std::thread::id는 가볍고 trivially copyable한 클래스로, std::thread 및 std::jthread(C++20부터) 객체의 고유 식별자 역할을 해요. 이 클래스의 인스턴스는 어떤 스레드도 나타내지 않는 특별한 구분 값을 가질 수도 있어요. 스레드가 종료되면 해당 std::thread::id 값은 다른 스레드에 재사용될 수 있어요.
출처: cppreference
본문
<thread> 헤더에 정의됨 |
|
|
class thread::id; |
|
(C++11부터) |
std::thread::id는 정렬 연관 컨테이너와 비정렬 연관 컨테이너 모두에서 키로 사용되도록 설계되었어요.
멤버 함수
| (constructor) |
스레드를 나타내지 않는 id를 생성해요 (public member function) |
비멤버 함수
operator==, operator!=, operator<, operator<=, operator>, operator>= (C++20에서 제거됨), operator<=> (C++20) |
두 thread::id 객체를 비교해요 (function) |
operator<< |
thread::id 객체를 직렬화해요 (function template) |
헬퍼 클래스
std::hash<std::thread::id> (C++11) |
std::thread::id에 대한 해시 지원 (class template specialization) |
std::formatter<std::thread::id> (C++23) |
thread::id에 대한 포맷 지원 (class template specialization) |
같이 보기
get_id |
스레드의 id를 반환해요 (public member function) |
get_id (C++11) |
현재 스레드의 스레드 id를 반환해요 (function) |
더 알아보기 (Learn more)
cppreference