All Concurrency Primitives
All Concurrency Primitives
A compact scan page for the main thread, lock, waiting, task, and atomic primitives in the C++ standard library.
All Concurrency Primitives
A compact scan page for the main thread, lock, waiting, task, and atomic primitives in the C++ standard library.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
Use this as a quick map. For grouped discussion, see C++ concurrency library.
std::threadstd::jthreadstd::this_threadstd::stop_sourcestd::stop_tokenstd::stop_callbackstd::mutexstd::recursive_mutexstd::timed_mutexstd::recursive_timed_mutexstd::shared_mutexstd::shared_timed_mutexstd::lock_guardstd::scoped_lockstd::unique_lockstd::shared_lockstd::lockstd::try_lockstd::condition_variablestd::condition_variable_anystd::notify_all_at_thread_exitstd::latchstd::barrierstd::counting_semaphorestd::binary_semaphorestd::future<T>std::shared_future<T>std::promise<T>std::packaged_taskstd::asyncstd::launchstd::future_statusstd::atomic<T>std::atomic_flagstd::atomic_ref<T>std::memory_ordermemory_order_relaxedmemory_order_consumememory_order_acquirememory_order_releasememory_order_acq_relmemory_order_seq_cststd::jthread for local thread ownership.#include <thread>
#include <mutex>
int main() {
std::mutex guard;
std::jthread worker([&] {
std::scoped_lock lock(guard);
});
}