Programming‎ > ‎Threading‎ > ‎

Thread API

You start out with 99 problems, fix one and have 101 left

This is the page is about the thread support in C++ 11. For other API's and languages look at the sub pages (Thread API Windows).

Thread support library
The class represents a single thread of execution.
  • join : waits for a thread to finish its execution
  • detach : Make the thread execute independently from the thread handle.
  • get_id : Get the id of the thread
  • native_handle : Get the native handle of the thread.
  • hardware_concurrency : Return number of concurrent threads supported
Namespace functions related to the current running thread.
  • std::thread::id get_id() : Return a id for the current thread.
  • yield(): Hint that the thread has nothing more to do right now and can be put to sleep.

Limit access to a shared resources.
  • lock - Locks mutex, blocks if mutex is not available.
  • try_lock - Try to lock the mutex, returns false if mutex not available.
  • unlock - Unlocks the mutex

Atomic operations library


C++11 threads, affinity and hyperthreading - 2016
How Ubisoft Montreal Develops Games For Multicore – Before and After C++11. - 2014
Double-Checked Locking Is Fixed In C++11 - 2013
Acquire and Release Fences Don’t Work the Way You’d Expect - 2013
The Synchronizes-With Relation - 2013
Acquire and Release Fences - 2013
Acquire and Release Semantics - 2012
Programming with Threads: Questions Frequently Asked by C and C++ Programmers
C++11 Language Extensions — Concurrency

Subpages (1): Thread API Windows