TimedMutex

The TimedMutex concept extends the TimedLockable concept to include inter-thread synchronization. Requirements TimedLockable Mutex Additionally, for object m of TimedMutex type. The expression m.try_lock_for(duration) has the following properties Behaves as an atomic operation. Attempts to obtain exclusive ownership of the mutex within the duration specified by duration. If duration is less or equal duration.zero(), attempts to obtain the ownership without locking (as if by try_loc

TimedLockable

The TimedLockable concept describes the characteristics of types that provide timed exclusive blocking semantics for execution agents (i.e. threads). Requirements For type L to be TimedLockable, the following conditions have to be satisfied for an object m of type L: Expression Requires Effects m.try_lock_for(duration) Blocks for the provided duration the resource m. m.try_lock_until(time_limit) Blocks the resource m until the provided time limit point is reached. See also T

throw expression

Signals an erroneous condition and executes an error handler. Syntax throw expression (1) throw (2) Explanation See try-catch block for more information about try and catch (exception handler) blocks 1) First, copy-initializes the exception object from expression (this may call the move constructor for rvalue expression, and the copy/move may be subject to copy elision), then transfers control to the exception handler with the matching type whose compound statement or

Thread support library

C++ includes built-in support for threads, mutual exclusion, condition variables, and futures. Threads Threads enable programs to execute across several processor cores. Defined in header <thread> thread (C++11) manages a separate thread (class) Functions managing the current thread Defined in namespace this_thread yield (C++11) suggests that the implementation reschedule execution of threads (function) get_id (C++11) returns the thread id of the current

thread_local

Usage thread local storage duration specifier (since C++11)

thread

This header is part of the thread support library. Classes thread (C++11) manages a separate thread (class) Functions std::swap(std::thread) (C++11) specializes the std::swap algorithm (function template) operator==operator!=operator< operator<= operator> operator>= compares two thread::id objects (function) operator<< serializes a thread::id object (function template) std::hash<std::thread::id> specializes std::hash (class templat

The as-if rule

Allows any and all code transformations that do not change the observable behavior of the program. Explanation The C++ compiler is permitted to perform any changes to the program as long as the following remains true: 1) At every sequence point, the values of all volatile objects are stable (previous evaluations are complete, new evaluations not started) (until C++11) 1) Accesses (reads and writes) to volatile objects occur strictly according to the semantics of the expressions in whic

The rule of three/five/zero

Rule of three If a class requires a user-defined destructor, a user-defined copy constructor, or a user-defined copy assignment operator, it almost certainly requires all three. Because C++ copies and copy-assigns objects of user-defined types in various situations (passing/returning by value, manipulating a container, etc), these special member functions will be called, if accessible, and if they are not user-defined, they are implicitly-defined by the compiler. The implicitly-defined speci

this pointer

Syntax this The keyword this is a prvalue expression whose value is the address of the object, on which the member function is being called. It can appear in the following contexts: 1) Within the body of any non-static member function, including member initializer list 2) within the declaration of a non-static member function anywhere after the (optional) cv-qualifier sequence, including dynamic exception specification(deprecated), noexcept specification(C++11), and the trailing r

this

Usage this pointer