[SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W]
#include <thread>, example of
<atomic> header, reference
<chrono> header
reference
<condition_variable> header
reference
<future> header
reference
<mutex> header
std::lock_guard
std::mutex
reference
<ratio> header
reference
<thread> header
introduced
std::thread class
std::this_thread::get_id
reference
ABA problem
abstraction penalty
ACE, and multithreaded code
actor model
address space
limit
shared
Amdahl’s law
serial fraction
atomic integral types
available operations
return value of operations
atomic operation
categories
compare_exchange_strong
bitwise comparison of a whole structure
checking for unchanged value
updating a whole structure atomically
using to avoid looping
using to extract a node from a queue
using to set a value conditionally
compare_exchange_weak() member function
compared to compare_exchange_strong
memory ordering in stack::push
use in a loop
compare-exchange functions
avoiding race conditions with
double-word-compare-and-swap (DWCAS)
defined
enforcing ordering with
example
simple example
fences
and memory_order_relaxed
fetch_add() member function, and release
sequences
happens-before relationship
implicit load
inter-thread happens-before relationship, and
sequenced-before
lock-free, enabling by using
memory ordering options
default
tags for memory ordering models
memory ordering, default
memory ordering, memory_order_seq_cst
on std::shared_ptr, 2nd
example
sequentially-consistent ordering
store operations
synchronizes-with relationship
defined.
See std::atomic class template, compare_exchange_strong() member function.
See std::atomic class template, compare_exchange_weak() member function.
atomic operations
enforcing ordering with
memory ordering options
atomic types
compare_exchange_weak() member function
compare-exchange functions
memory ordering parameters
spurious failure
internal locks
introduction
is_lock_free() member function
lack of assignment
lack of copy-construction
list of alternative names
list of typedefs, 2nd
lock-free operations
naming convention for alternative names
nonmember functions
naming convention
std::atomic_compare_exchange_weak
std::atomic_compare_exchange_weak_explicit
std::atomic_flag_clear
std::atomic_flag_clear_explicit
std::atomic_flag_test_and_set
std::atomic_flag_test_and_set_explicit
std::atomic_is_lock_free
std::atomic_load
std::atomic_store
std::atomic_store_explicit
operation return values
operations with nonmember functions
overview of operations
restrictions
std::atomic class template
and relationship with alternative names
use with user-defined type
using compare_exchange_strong on a structure
using with a user-defined type
std::atomic_address, use with hazard pointers
atomic types, assignment operator, return type
atomic variable, use as a done flag
ATOMIC_ADDRESS_LOCK_FREE macro
ATOMIC_BOOL_LOCK_FREE macros
ATOMIC_CHAR_LOCK_FREE macro
ATOMIC_CHAR16_T_LOCK_FREE macro
ATOMIC_CHAR32_T_LOCK_FREE macro
ATOMIC_FLAG_INIT macro
ATOMIC_INT_LOCK_FREE macro
ATOMIC_LLONG_LOCK_FREE macro
ATOMIC_LONG_LOCK_FREE macro
ATOMIC_SHORT_LOCK_FREE macro
ATOMIC_VAR_INIT macro
ATOMIC_WCHAR_T_LOCK_FREE macro
auto keyword
automatic type deduction
and function template parameters
deduction rules
syntax
background threads
bit-field, using to keep structure within machine word
blocked thread
blocking
Boost, and multithreaded code
boost::shared_mutex, 2nd
bounded queue
C++ Standard
overhaul
support for multithreaded programs
cache ping-pong, and performance
callable type
code reviews
guidelines
rubber chicken
Communicating Sequential Processes
actor model
and lack of shared data
compare-exchange functions.
See atomic operation, compare-exchange functions.
concurrency
and constructors
and destructors
and multithreading
and responsiveness
and user interfaces
approaches to
data structure
definition
design guidelines
efficiency
enabling
by separating data
with fine-grained locking
hardware, 2nd
Hello World
illusion of
in computer systems
limiting
memory model, 2nd
multiple processes
advantage
downside
multiple threads
advantage
downside
opportunity for
optimization
overhead, 2nd
parallel execution
performance
performance problem
lock granularity
potential for, 2nd
preventing
problem
contention
deadlock
race condition
reasons for using
performance
separation of concerns
reasons to avoid
safe
support in C++11 standard
concurrency bugs
and shared memory
broken invariants
code review questions
deadlock
difficulty of reproducing
distinguishing from other bugs
lifetime issues
livelock
locating
stale data
symptoms
testing
unwanted blocking
with code reviews
wrong mutex scope
constant expressions
and constexpr
and literal types
array bounds
in-class initializers
nontype template parameters
places that require them
static initialization for aggregates
constexpr functions
and constant expressions
and mutex initialization
and static initialization
avoiding race conditions
and templates
constructors
and static initialization
trivial constructors
member functions
and virtual
implied const
no side effects
not always constant expressions
pure functions
requirements
syntax
constexpr objects
implicit const
context switching
defined
conveniently concurrent
daemon threads
data parallelism
data race, 2nd
defined
dereferencing a loaded pointer
due to unsupported usage
undefined behavior
with double-checked locking
deadlock
avoiding
breaching guidelines
fixed-order locking, 2nd, 3rd
no callbacks
no nested locks
with a lock hierarchy
with std::lock
defined
guidelines for avoiding
impossibility with hierarchical mutex
with children’s toys
with std::thread objects
defaulted functions
and accessibility
and aggregates
and copy constructors
and default constructors
and default initialization
and trivial functions
and virtual destructors
examples
reasons for defaulting
syntax
things that can be defaulted
deleted functions
and overload resolution
example
preventing copying
preventing narrowing
syntax
dividing work
by task
comparing complexity of alternatives
data access patterns
dividing data recursively
early completion
generalist threads vs. specialist threads
guidelines
matrix multiplication
performance characteristics
pipeline
recursively
separating concerns
specialist threads
splitting data
std::async
std::thread::hardware_concurrency
threads vs. tasks
to reduce data accessed in each thread
double-checked locking
defined
race condition
undefined behavior
doubly-linked list
deleting from
invariant
dual-core
dummy nodes, in a lock-free queue
DWCAS (double-word-compare-and-swap)
embarrassingly parallel
Erlang, 2nd
event loops, and responsiveness
event-driven architecture
example
basic barrier
exception_safe_parallel_accumulate
with std::async
function to run a pending task from a thread
pool
GUI event loop
interruptible_thread interface
join_threads class
naïve parallel_accumulate
parallel_accumulate
with a thread pool
with std::packaged_task
parallel_find
using std::async
parallel_for_each, 2nd
parallel_partial_sum
with even division
with pairwise updates
parallel_quick_sort using thread pool
queue for work-stealing
scoped_thread
thread pool with work stealing
thread_guard
with per-thread work queues
examples, test for concurrent queue
exception safety
achieving with std::async
and destroying futures
and std::packaged_task
in std::stack
single vs. multithreaded
exceptions, and std::async
false sharing
avoiding with padding
between mutex and protected data
performance implications
fine-grained locking
difficulties
placing locks
functional programming
and (lack of) race conditions
future, defined
futures
and stored exceptions
getting from a std::packaged_task
getting from a std::promise
getting from std::async
storing exceptions
using for thread return values
global variables
GUI frameworks
and threads
hardware concurrency
defined
hardware threads
hazard pointer
checking for outstanding pointers
defined
marking a pointer as hazardous
overhead from simple implementation
patent
reclaiming memory
simple allocation scheme
simple example of reclaiming nodes
trading memory for speed
updating
usage overview
hierarchical mutex
example
sample implementation
impure functions, defined
initial function
interrupting threads
and exception safety
background threads
basic interface
basic interruptible_thread implementation
catching interruptions
detecting interruption
example implementation
handling interruptions
interrupt function
interruptible_wait on a
condition_variable_any
interrupting future waits
interrupting waiting on a
condition_variable
interruption point
interruption_point function
per-thread data structure
race condition in naïve implementation
sample implementation
using a timeout
invariant
and exception safety
and race conditions, 2nd
and thread-safety
broken, 2nd
defined
for a queue
in lock-free data structures
preserving, 2nd
iterators, and concurrency
join_threads class, use with thread pool
join, std::threads, example of
joining threads, when exceptions thrown
lambda function
and local variables
as predicates
captures
and class members
by copy
by reference
mixing copy and reference captures
this
example with std::condition_variable::wait
lambda introducer
return values
automatic deduction
explicit declaration syntax
syntax
use with std::condition_variable
with parameters
lazy initialization
defined
example of
example using mutex
example using std::call_once
lifetime issues
lightweight processes
literal type
and constant expressions
and constexpr functions
and static initialization
defined
example
live lock, defined
local objects, destruction of
lock-based data structures
bounded queue
vs. unbounded queue
list
find_first_if()
for_each()
interface design
iteration
operations
opportunities for concurrency
push_front()
remove_if()
sample implementation
lookup table
consequences of hash table implementation
consequences of sorted array implementation
exception safety
extracting contents
fine grained locking
hash function
implementation choices
interface design
operations
protecting buckets
queue
analysis of required locks
and exception safety
avoiding data races
exception safety and waiting
fine-grained locks
implementation using std::shared_ptr
implementation with fine-grained locking and waiting
interface differences from std::queue
invariants
potential for concurrency
sample implementation with fine-grained locking
simple implementation
waiting
waiting for an entry
stack
and deadlock
and race conditions
basic thread safety
exception safety
potential for concurrency
sample code
serialization
unbounded queue
vs. bounded queue
lock-free data structures
ABA problem
and compare-exchange
and invariants
and memory ordering constraints
atomic operations
busy-wait
defined
guidelines for writing
helping stalled threads
impossibility of deadlocks
introduced
lock-free property, ensuring by helping other thread
managing memory, 2nd
alternatives to new and delete
freeing memory at quiescent points
hazard pointers
memory reclamation schemes
recycling nodes
split reference count, primary reason
split reference counts
maximizing concurrency
optimizing memory allocation
performance, 2nd
prototyping
queue
avoiding race conditions
handling multiple producers
implementation of pop() with a ref-counted tail
obtaining a new reference to a node
pop() implementation for lock-free push()
push() implementation using helping for lock-free semantics
releasing a reference on a node
releasing an external counter to a node
sample implementation of push() with refcounted tail
single producer, single consumer
single-producer, single-consumer implementation
synchronizing push() and pop()
split-count reference counting, deleting nodes
stack
adding a node
basic push function
basic structure
example counting threads in pop
example implementation with memory leak
exception safety
implementation of pop using hazard pointers
implementation with reference counting and relaxed operations
popping a node with split reference counts
potential race conditions
pushing a node with split reference counts
removing nodes
sample implementation using shared_ptr
starvation
std::atomic_is_lock_free function, std
unintended locking
lock-free programming, defined
locking
granularity
choosing
coarse-grained
defined
fine-grained, 2nd, 3rd
too large
too small
hand over hand, 2nd, 3rd
multiple mutexes, std::lock
lookup table, interface design
choices for add and change
choices for querying values
lvalue references
and rvalue references
and temporaries
massively parallel
memory allocation, moving outside a lock
memory barriers
memory location
and bit-fields
zero-length
and object
and race conditions
defined
example struct
memory model
acquire-release ordering
and happens-before
and inter-thread happens-before
and mutexes
and synchronizes-with
and synchronizing data between threads
carries-a-dependency-to relation defined
choice of semantics for read-modify-write operations
data dependency
dependency-ordered-before
and inter-thread-happens-before
compared to synchronizes-with
relation defined
example of data dependent ordering
example of transitive synchronization
example sequence
example with imposed ordering
example with no total order
lack of synchronization with relaxed operations
man in cubicle analogy
memory_order_acq_rel, 2nd
memory_order_acquire, 2nd, 3rd
memory_order_consume
memory_order_release, 2nd, 3rd
mixing with sequentially-consistent ordering
synchronization cost
synchronization using acquire and release pairings
transitive synchronization
across threads
using read-modify-write operations
applying to lock-free stack
applying, identifying required relationships
fences
example of ordering relaxed operations
memory_order_acquire
memory_order_release
synchronizes-with
happens-before relationship
and relaxed ordering
and sequenced-before
between push() and pop() on a queue
between threads
defined
in a single-thread
nonatomic operations
inter-thread happens-before relationship
and synchronizes-with
defined
lock() example memory ordering
memory ordering
memory ordering options
and ordering models
and varying costs with CPU architecture
default
default ordering
modification order
and relaxed ordering
defined
non-sequentially-consistent orderings
and lack of agreement between threads
and lack of global order
optimizing memory ordering
ordering constraints
relaxed ordering
example
example sequence
man-in-cubicle analogy
memory_order_relaxed, 2nd
release sequence
and memory_order_relaxed
defined
example
example sequence
in lock-free stack
memory_order_acq_rel
memory_order_acquire
memory_order_consume
memory_order_release
memory_order_seq_cst
sequenced-before relationship, and happens before
sequential consistency, defined
sequentially-consistent ordering
additional implied ordering relationships
and global order
and happens-before
and mutexes
and synchronizes-with
cost
example
memory_order_seq_cst
mixing with acquire-release ordering
ordering diagram
performance penalty
synchronization cost
using for prototyping
splitting operations to vary memory ordering
synchronizes-with relationship
and relaxed ordering
defined
unlock() example memory ordering
message passing
actor model
and state machines
ATM example
actor model
division into threads
example state function
handling different types of message
handling messages
messages as structs
sample code
state machine model
waiting for matching messages
waiting for messages
implicit synchronization
no shared state
move constructors
and copy constructors
example
move semantics
and deleted copy operations
and optimization
and rvalue references
and rvalues
and std::thread
and std::unique_ptr
move constructors, example
moved-from state
of std::thread
move-only types
example
in the thread library
moving from an lvalue
multicore, 2nd
multiprocessor
multithreaded
multithreading
history
memory model
support in the C++11 standard
mutex
defined
lock
lock ownership, transferring
recursive
unlock
user-defined
example
example implementation, 2nd
requirements
using
mutual exclusion
native_handle
naturally parallel
nonblocking operations, defined
object
and variables
defined
division into subobjects
example struct
subobject
oversubscription, avoiding
parallel_find, and out-of-order processing
performance
Amdahl’s law
and cache line pressure
and data structures
and multiple processors
and mutexes
and reader-writer mutexes
and task switching
cache miss, 2nd
cache ping-pong
data contention
data proximity
false sharing
hiding latency
high contention
I/O latency
idle threads
low contention
massively parallel
multiple applications
number of processors
oversubscription, 2nd
reducing time taken vs. processing more data
scalability
scaling
std::async
std::thread::hardware_concurrency
thread pools
too many threads
platform-specific facilities, 2nd, 3rd
pure function, defined
queue
bounded queue
single-threaded implementation
with dummy node
unbounded
Quicksort
example parallel implementation
FP-style sequential implementation
simple parallel implementation
race condition
and exception safety
avoiding
by atomic update of a whole structure
with atomic compare-exchange functions
with enforced ordering
benign
data race
defined
defined
eliminating
example
in interface, 2nd
stack example
initialization of local static
problematic
window of opportunity
with double-checked locking
race conditions
and testing
RAII.
See Resource Acquisition Is Initialization.
recursive mutex
reduction
reference to a reference
Resource Acquisition Is Initialization
and threads, 2nd
for mutexes, std::lock_guard
scoped_thread example
thread_guard example
responsiveness
rvalue references
and lvalue references
and move semantics
and static_cast
and std::move
and template argument type deduction
and template parameters
and temporaries
described
parameters treated as lvalues
scalability
Amdahl’s law
parallel vs. serial sections
scoped_thread example
separation of concerns, and concurrency
serialization, 2nd
minimizing
shared data
encapsulating
failure to protect
example
problems
protecting
guideline
incomplete protection
initialization
single global mutex
structuring code
with correct mutex
with mutex
with std::call_once
with std::mutex
read-only
shared memory
SI ratios
single-core
Single-Instruction/Multiple-Data (SIMD)
single-threaded
sizeof..., and variadic templates
Software Transactional Memory, defined
spurious wake, defined
std::adopt_lock
and std::lock_guard
example
std::any_of
std::async
and asynchronous tasks
and dividing work recursively
and exceptions, 2nd
and oversubscription
and parallel_for_each
and std::future, 2nd, 3rd
compare to std::thread
comparison with std::packaged_task
example of passing arguments
exception propagation
exception safety
introduction
passing additional arguments
passing reference arguments with std::ref
reference
simple example
unsuitability for interdependent tasks
use for exception safety
vs. custom spawn_task function
vs. simple thread pools
vs. thread pools
std::atomic class template
and relationship with alternative names
and user-defined types, 2nd
available operations
bitwise comparison and compare/exchange functions
class definition
compare_exchange_strong() member function
compare_exchange_weak() member function
conversion assignment operator
conversion constructor
conversion to nonatomic type
default constructor
exchange() member function
fetch_add() member function
for pointer specializations
fetch_and() member function
fetch_or() member function
fetch_sub() member function
for pointer specializations
fetch_xor() member function
is_lock_free() member function
load() member function
operator-- postdecrement
for pointer specializations
operator-- predecrement
for pointer specializations
operator^=
operator&=
operator++ postincrement
for pointer specializations
operator++ preincrement
for pointer specializations
operator+=
for pointer specializations
operator-=
for pointer specializations
operator|=
reference
restricted operations
specializations
for built-in types
for integral types
for pointer types
std::atomic_compare_exchange_strong_explicit() nonmember function
std::atomic_compare_exchange_strong() non-member function
std::atomic_compare_exchange_weak_explicit() nonmember function
std::atomic_compare_exchange_weak() non- member function
std::atomic_exchange nonmember() function
std::atomic_exchange_explicit() nonmember function
std::atomic_fetch_add_explicit() nonmember function
for pointer specializations
std::atomic_fetch_add() nonmember function
for pointer specializations
std::atomic_fetch_and_explicit() nonmember function
std::atomic_fetch_and() nonmember function
std::atomic_fetch_or_explicit() nonmember function
std::atomic_fetch_or() nonmember function
std::atomic_fetch_sub_explicit() nonmember function
for pointer specializations
std::atomic_fetch_sub() nonmember function
std::atomic_fetch_sub() nonmember function for pointer specializations
std::atomic_fetch_xor_explicit() nonmember function
std::atomic_fetch_xor() nonmember function
std::atomic_init() nonmember function
std::atomic_is_lock_free() nonmember function
std::atomic_load_explicit() nonmember function
std::atomic_load() nonmember function
std::atomic_store_explicit() nonmember function
std::atomic_store() nonmember function
store() member function.
See std::atomic partial specialization for pointer types.
std::atomic partial specialization for pointer types
arithmetic operators
memory ordering
return value
fetch_add() member function
example
memory ordering choices
return value
fetch_sub() member function
memory ordering choices
return value
std::atomic_flag, 2nd
and ATOMIC_FLAG_INIT
and std::atomic_flag_test_and_set nonmember function
class definition
clear() member function, 2nd, 3rd
default constructor
initialization
initialization with ATOMIC_FLAG_INIT
introduction
nonmember functions, std
states
std::atomic_flag_clear_explicit() nonmember function
std::atomic_flag_clear() nonmember function
std::atomic_flag_test_and_set_explicit() non-member function
test_and_set() member function, 2nd, 3rd
std::atomic_signal_fence() nonmember function
std::atomic_thread_fence() nonmember function
std::atomic_xxx typedefs
std::atomic<bool>
assignment from bool
return type
compare_exchange_strong() member function
compare_exchange_weak() member function
loop to handle spurious failures
comparison with std::atomic_flag
exchange() member function
is_lock_free() member function
load() member function
store() member function
std::atomic<double>, and compare_exchange_strong
std::atomic<float>
and compare_exchange_strong
lack of arithmetic operations
std::call_once
and std::once_flag
example
introduced
using local static as alternative
std::chrono::duration
and duration-base timeouts
count() member function
std::chrono::duration class template
and std::recursive_timed_mutex::try_lock_for
and std::shared_future::wait_for
and std::this_thread::sleep_for
and std::timed_mutex::try_lock_for
and std::unique_lock
and std::unique_lock::try_lock_for
class definition
converting constructor from a count
converting constructor from another duration
count() member function
default constructor, 2nd
duration_cast() nonmember function
max() static member function, 2nd
min() static member function, 2nd
operator
operator-
operator-- postdecrement
operator-- predecrement
operator!=
operator*=
operator/=
operator%=
operator+
operator++ postincrement
operator++ preincrement
operator+=, 2nd
operator-=, 2nd
operator==
operator>
operator>=
period member
reference
rep member
time_since_epoch() member function
use in std::chrono::system_clock
use with std::future::wait_for
zero() static member function
std::chrono::duration_cast
std::chrono::high_resolution_clock
definition
potential relationship with std::chrono::steady_clock
potential relationship with std::chrono::system_clock
reference
std::chrono::steady_clock
class definition
duration member typedef
now() static member function
period member typedef
reference
rep member
time_point member typedef
std::chrono::system_clock
class definition
reference
time_t
conversion from time_t to time_point
conversion to time_t from time_point
to_time_point() static member function, 2nd
to_time_t() member function
std::chrono::system_clock::duration member, definition
std::chrono::system_clock::now member, definition
std::chrono::system_clock::period member, definition
std::chrono::system_clock::rep member, definition
std::chrono::system_clock::time_point member, definition
std::chrono::time_point
and absolute timeouts
clocks, adjustment during absolute-time-based waits
introduction
time_since_epoch() member function
std::chrono::time_point class template
and std::future::wait_until
and std::recursive_timed_mutex::try_lock_until
and std::shared_future::wait_until
and std::this_thread::sleep_until
and std::timed_mutex::try_lock_until
and std::unique_lock
and std::unique_lock::try_lock_until
class definition
reference
use in std::chrono::system_clock
std::condition_variable
and std::notify_all_at_thread_exit
and timeouts when waiting
class definition
default constructor
destructor
example
notify_all() member function, 2nd
and std::notify_all_at_thread_exit
relationship to wait
vs. notify_one
notify_one() member function, 2nd
calling outside a lock
relationship to wait
relationship with notify_all()
relationship with wait_for()
relationship with wait_until()
relationship with wait()
use in a thread-safe queue
use with a concurrent queue
vs. notify_all
reference
wait_for() member function, 2nd
and std::chrono::duration class template
and std::cv_status enum
and std::notify_all_at_thread_exit()
and std::unique_lock class template
with a predicate
wait_until() member function, 2nd
and std::chrono::time_point class template
and std::notify_all_at_thread_exit()
and std::unique_lock class template
with a predicate
wait() member function, 2nd
and callable objects
and condition-checking functions
and functions
and spurious wakes
and std::notify_all_at_thread_exit
and std::unique_lock
choosing a predicate
relationship to notify_all
relationship to notify_one
use in a thread-safe queue
use with a concurrent queue
with a predicate
waiting with a timeout example
wait_for vs. wait_until
waking all waiting threads
waking one waiting thread
std::condition_variable_any
and timeouts when waiting
default constructor
destructor
notify_all() member function
notify_one() member function
try_lock_for() member function
wait_for() member function, 2nd
with a predicate
wait_until() member function, 2nd
with a predicate
wait() member function
with a predicate
std::copy_exception
std::count
std::current_exception
std::cv_status
std::equal
std::find, parallelizing
std::for_each, parallelizing
std::function, use with thread pool
std::future
and
and exception safety, 2nd
and propagating exceptions
and thread pool tasks
and threads from std::async calls
and timeouts when waiting
and unique ownership
conversion to std::shared_future
example
obtaining from std::packaged_task
propagating exceptions
propagating exceptions from get()
share() member function
and automatic deduction of variable type
vs. std::shared_future
wait_for() member function
wait_until() member function
std::future class template
and std::async
and std::packaged_task
and std::promise
class definition
conversion to std::shared_future, 2nd
default constructor
destructor
get() member function
move assignment operator
move constructor
reference
share() member function
valid() member function
wait_for() member function
and std::chrono::duration
wait_until() member function
and std::chrono::time_point
wait() member function
std::future_errc::broken_promise
std::future_error, introduction
std::future_status, 2nd
std::future<void>, as a done flag
std::launch::async, using to guarantee separate threads
std::lock
and exceptions
and std::unique_lock
avoiding deadlock with
example
std::lock function template, reference
std::lock_guard
adopting a lock
and user-defined types
comparison with std::unique_lock
example
std::lock_guard class template
class definition
destructor
lock-adopting constructor
locking constructor
reference
std::make_shared, use for allocating a referencecounted object
std::memory_order enumeration
std::memory_order_acq_rel, reference
std::memory_order_acquire
reference
std::memory_order_consume, reference
std::memory_order_relaxed
reference
std::memory_order_release
reference
std::memory_order_seq_cst, reference
std::move
and std::thread
std::mutex
class definition
default constructor
example
lock() member function
locking
locking with
std::lock
std::lock_guard
reference
try_lock() member function
unlock() member function
unlocking
using
std::nested_exception, use for accumulating
multiple exceptions
std::notify_all_at_thread_exit, and
std::condition_variable::notify_all()
std::once_flag
default constructor
introduced
reference
std::call_once() nonmember function template
std::packaged_task
and exception safety
and std::future
as a callable object
comparison with std::async
compatible callable types
get_future() member function
introduction
obtaining a future
obtaining a std::future
passing tasks between threads
template parameter
wrapping tasks for a thread pool
std::packaged_task class template
and std::future
class definition
construction from a callable object
with an allocator
default constructor
destructor
function call operator()
get_future() member function
make_ready_at_thread_exit() member function
move assignment operator
move constructor
reference
reset() member function
swap() member function
valid() member function
std::partial_sum
alternative approaches
parallelizing
std::promise
and obtaining a result from multiple threads
and std::future
and stored exceptions
example
get_future() member function
obtaining a future
set_exception() member function
set_value() member function, 2nd
using for test scheduling
std::promise class template
and std::future
class definition
construction with an allocator
default constructor
destructor
get_future() member function
move constructor
move-assignment operator
reference
set_exception_at_thread_exit() member function
set_exception() member function
set_value_at_thread_exit() member function
set_value() member function
swap() member function
std::queue
and thread safety
interface
potential for race conditions
std::ratio class template
class definition
reference
use in std::chrono::system_clock
use with std::chrono::duration
std::ratio_add, reference
std::ratio_divide, reference
std::ratio_equal, reference
std::ratio_greater_equal, reference
std::ratio_greater, reference
std::ratio_less_equal, reference
std::ratio_less, reference
std::ratio_multiply, reference
std::ratio_not_equal, reference
std::ratio_subtract, reference
std::recursive_mutex
class definition
default constructor
destructor
introduced
lock() member function
reference
try_lock() member function
unlock() member function
std::recursive_timed_mutex
and timeouts when locking
class definition
default constructor
destructor
lock() member function
locking operations with timeouts
reference
try_lock_for() member function, 2nd
and std::chrono::duration
try_lock_until() member function
and std::chrono::time_point
try_lock() member function
unlock() member function
std::ref
passing reference arguments to std::async
std::result_of, getting task return types
std::shared_future
and shared ownership
and timeouts when waiting
conversion from std::future
separate copy per thread
spreadsheet example
using for test scheduling
vs. std::future
wait_for() member function
wait_until() member function
std::shared_future class template
class definition
construction from std::future
copy constructor
default constructor
destructor
get() member function
move constructor
reference
valid() member function
wait_for() member function
wait_until() member function
and std::chrono::duration
and std::chrono::time_point
wait() member function
std::stack, interface
std::terminate
and std::thread destructor
std::this_thread::get_id
std::this_thread::get_id() nonmember function
and std::thread::id
std::this_thread::sleep_for
described
example
std::this_thread::sleep_for() nonmember function
and std::chrono, duration
std::this_thread::sleep_until
std::this_thread::sleep_until() nonmember function
and std::chrono::time_point
std::this_thread::yield
use in spin-wait
std::this_thread::yield() nonmember function
std::thread
and standard containers
and std::vector
as function return value
class definition
constructing
constructor, 2nd
and std::move
moving arguments
constructor accepting multiple arguments
default constructor
destructor, 2nd
and joinable
and std::terminate
detach() member function, 2nd, 3rd
relationship with joinable()
get_id() member function, 2nd
hardware_concurrency() static member function, 2nd, 3rd
join() member function, 2nd, 3rd
and interaction with joinable()
example of
joinable() member function, 2nd, 3rd
and interaction with join()
relationship with detach()
move assignment
move construction
move constructor
move semantics
move-assignment
moving
from temporaries
native_handle_type
native_handle() member function
pass by value
reference
std::swap() nonmember function
std::thread::id
and std::this_thread::get_id()
class definition
default constructor
operator
operator!=
operator==
operator>
operator>=
swap() member function
variadic constructor
std::thread::hardware_concurrency
and choosing the number of threads
and thread management
use with thread pools
std::thread::id
comparison operators
specialization of std::hash
stream insertion operator
total order
std::timed_mutex
and timeouts when locking
class definition
default constructor
destructor
lock() member function
reference
support for locking operations with a timeout
try_lock_for() member function
and std::chrono::duration
try_lock_until() member function, 2nd
and std::chrono::time_point
try_lock() member function
unlock() member function
std::try_lock() function template, reference
std::unique_lock
and std::lock
and std::move
and TimedLockable types
comparison with std::lock_guard
constructors that accept timeouts
deferred locking
example of releasing lock early
introduced
moving
owns_lock member() function detecting timeout on lock acquisition
returning from a function
try_lock_for() member function
try_lock_until() member function, 2nd, 3rd, 4th, 5th
unlocking
using with std::condition_variable
std::unique_lock class template
and std::condition_variable::wait
and std::condition_variable::wait() with a predicate
and std::notify_all_at_thread_exit()
bool conversion operator
class definition
default constructor
deferred-lock constructor
destructor
lock() member function
lock-adopting constructor
locking constructor
move constructor
move-assignment operator
mutex() member function
owns_lock() member function, 2nd
and std::notify_all_at_thread_exit()
reference
release() member function
std::swap() nonmember function
swap() member function
try_lock_for() member function
and std::chrono::duration
try_lock_until() member function
and std::chrono::time_point
try_lock() member function
try-to-lock constructor
with a duration timeout
with a time_point timeout
unlock() member function
std::unique_ptr, as example of move semantics
std::vector, of std::thread
synchronization mechanisms, barrier
task parallelism
task switching
defined
example of
illusion of concurrency
templates, variadic
testing concurrent code
adjusting the thread count
architecture variations
avoid deadlock in test code
boilerplate test structure
brute force testing
combination simulation testing
controlling thread execution order
controlling thread scheduling
designing for testability
detecting potential deadlocks
eliminate concurrency
environmental considerations
false confidence
general guidelines
general outline
general setup
levels of confidence
library functions with internal state
memory ordering issues
on single- vs. multicore systems
performance testing
scalability
techniques
test granularity
test structure, 2nd
testing on single-processor systems
testing with a debug library
thread-specific setup
unpredictable scheduling
verifying a bug is concurrency related
vs. testing single-threaded code
thread
defined
detached, example
fire and forget
function
hardware
launching
running in the background
waiting for
and RAII idiom
thread function
passing arguments
avoiding undefined behavior
by reference
moving
type of arguments
using a member function
using std::ref for arguments
thread pool, 2nd
and exception safety
cache locality
choosing a task size
contention
defined
dynamic sizing
fixed size
potential for deadlock
queue contention
running tasks while waiting
scalability
simple example
stealing tasks from other worker threads
task size
tasks vs. threads
uneven work distribution
vs. std::async
waiting for tasks with std::future
work queue
work stealing
worker threads
wrapping tasks in std::packaged_task
thread_guard example
thread_local keyword
example
example usage
reference
use for interrupting threads
use for per-thread work queues
threads
dividing work
hardware, number of
number of, choosing
thread-safe queue
clocks, standard-provided clocks
example interface
initial sample implementation
using condition variables
push() member function
wait_and_pop() member function
thread-safe stack, example
thread-safe, defined
time facilities
<chrono> header
clocks
adjustment during duration-based waits
is_steady member
now() member function
period member
shared epochs
std::chrono::high_resolution_clock
std::chrono::steady_clock
std::chrono::system_clock
steady clocks
tick period
time_point member
durations
duration arithmetic
duration-based waits
explicit conversions
implicit conversions
predefined typedefs
std::chrono::duration
steady clocks
table of functions which accept timeouts
time points
and absolute timeouts
epoch
representation
time_t
conversion from
std::chrono::system_clock::time_point
conversion to
std::chrono::system_clock::time_point
timeouts
absolute
duration-based
function suffixes
undefined behavior, 2nd
access after destruction
from dangling pointers
from data race
recursive locking of nonrecursive mutex
variadic templates
and partial specialization, pattern matching
and std::packaged_task
and std::thread
pack expansion
and function parameters
example
expanding a pattern
syntax
parameter packs
expanding
function parameters
sizeof...
syntax
wait-free data structures
and robustness
defined
waiting for an event
by polling
by sleeping and polling
multiple waiting threads
one-off events
with condition variables
with futures
worker threads, introduced
18.221.136.142