A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../atomic.html below:

Concurrency support library (since C++11)

Concurrency support library

C++ includes built-in support for threads, atomic operations, mutual exclusion, condition variables, and futures.

[edit] Threads

Threads enable programs to execute across several processor cores.

manages a separate thread
(class) [edit] std::thread with support for auto-joining and cancellation
(class) [edit] Functions managing the current thread suggests that the implementation reschedule execution of threads
(function) [edit] returns the thread id of the current thread
(function) [edit] stops the execution of the current thread for a specified time duration
(function) [edit] stops the execution of the current thread until a specified time point
(function) [edit] [edit] Cooperative cancellation (since C++20)

The components stop source, stop token, and stop callback can be used to asynchronously request that an operation stops execution in a timely manner, typically because the result is no longer required. Such a request is called a stop request.

These components specify the semantics of shared access to a stop state. Any object modeling any of these components that refer to the same stop state is an associated stop source, stop token, or stop callback, respectively.

They are designed:

(since C++26)

In fact, they do not even need to be used to "stop" anything, but can instead be used for a thread-safe one-time function(s) invocation trigger, for example.

[edit] Cache size access (since C++17) [edit] Atomic operations

These components are provided for fine-grained atomic operations allowing for lockless concurrent programming. Each atomic operation is indivisible with regards to any other atomic operation that involves the same object. Atomic objects are free of data races.

Neither the _Atomic macro, nor any of the non-macro global namespace declarations are provided by any C++ standard library header other than <stdatomic.h>.

[edit] Mutual exclusion

Mutual exclusion algorithms prevent multiple threads from simultaneously accessing shared resources. This prevents data races and provides support for synchronization between threads.

provides basic mutual exclusion facility
(class) [edit] provides mutual exclusion facility which implements locking with a timeout
(class) [edit] provides mutual exclusion facility which can be locked recursively by the same thread
(class) [edit] provides mutual exclusion facility which can be locked recursively
by the same thread and implements locking with a timeout
(class) [edit] provides shared mutual exclusion facility
(class) [edit] provides shared mutual exclusion facility and implements locking with a timeout
(class) [edit] Generic mutex management implements a strictly scope-based mutex ownership wrapper
(class template) [edit] deadlock-avoiding RAII wrapper for multiple mutexes
(class template) [edit] implements movable mutex ownership wrapper
(class template) [edit] implements movable shared mutex ownership wrapper
(class template) [edit] tags used to specify locking strategy
(tag)[edit] Generic locking algorithms attempts to obtain ownership of mutexes via repeated calls to try_lock
(function template) [edit] locks specified mutexes, blocks if any are unavailable
(function template) [edit] Call once helper object to ensure that call_once invokes the function only once
(class) [edit] invokes a function only once even if called from multiple threads
(function template) [edit] [edit] Condition variables

A condition variable is a synchronization primitive that allows multiple threads to communicate with each other. It allows some number of threads to wait (possibly with a timeout) for notification from another thread that they may proceed. A condition variable is always associated with a mutex.

[edit] Semaphores (since C++20)

A semaphore is a lightweight synchronization primitive used to constrain concurrent access to a shared resource. When either would suffice, a semaphore can be more efficient than a condition variable.

[edit] Latches and Barriers (since C++20)

Latches and barriers are thread coordination mechanisms that allow any number of threads to block until an expected number of threads arrive. A latch cannot be reused, while a barrier can be used repeatedly.

[edit] Futures

The standard library provides facilities to obtain values that are returned and to catch exceptions that are thrown by asynchronous tasks (i.e. functions launched in separate threads). These values are communicated in a shared state, in which the asynchronous task may write its return value or store an exception, and which may be examined, waited for, and otherwise manipulated by other threads that hold instances of std::future or std::shared_future that reference that shared state.

[edit] Safe reclamation (since C++26)

Safe-reclamation techniques are most frequently used to straightforwardly resolve access-deletion races.

Read-Copy-Update mechanism allows an object to be protected by RCU
(class template) [edit] provides regions of RCU protection
(class) [edit] returns a reference to a static-duration object of type std::rcu_domain
(function) [edit] blocks until a protection region unlocks on a RCU domain
(function) [edit] may evaluate scheduled operations on a RCU domain and blocks until all preceding evaluations are complete
(function) [edit] schedules the evaluation of a specified function on a RCU domain, potentially allocating memory, and invoking scheduled evaluations
(function template) [edit] Hazard pointers allows an object to be hazard-protectable
(class template) [edit] single-writer multi-reader pointer that can be owned by at most one thread at any point of time
(class) [edit] constructs a hazard pointer
(function) [edit] [edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4