Namespaces
Variants
Views
Actions

std::thread::id

From cppreference.com
< cpp‎ | thread‎ | thread
 
 
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
Safe Reclamation
(C++26)
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
Free functions for atomic operations
Free functions for atomic flags
 
 
std::thread::id
Member functions
Non-member functions
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
Helper classes
 
Defined in header <thread>
class thread::id;
(since C++11)

The class thread::id is a lightweight, trivially copyable class that serves as a unique identifier of std::thread and std::jthread(since C++20) objects.

Instances of this class may also hold the special distinct value that does not represent any thread. Once a thread has finished, the value of std::thread::id may be reused by another thread.

This class is designed for use as key in associative containers, both ordered and unordered.

Contents

[edit] Member functions

constructs an id that does not represent a thread
(public member function)

[edit] Non-member functions

(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20)
compares two thread::id objects
(function) [edit]
serializes a thread::id object
(function template) [edit]

[edit] Helper classes

hash support for std::thread::id
(class template specialization) [edit]
formatting support for thread::id
(class template specialization) [edit]

[edit] See also

returns the id of the thread
(public member function) [edit]
(C++11)
returns the thread id of the current thread
(function) [edit]