Difference between revisions of "cpp/atomic/atomic is lock free"
(move notes to the end) |
(fmt) |
||
Line 3: | Line 3: | ||
{{dcl begin}} | {{dcl begin}} | ||
{{dcl header | atomic }} | {{dcl header | atomic }} | ||
− | {{dcl rev begin | num=1 | + | {{dcl rev begin | num=1 | since=c++11}} |
− | + | {{dcl | 1= | |
template< class Atomic > | template< class Atomic > | ||
bool atomic_is_lock_free( const volatile Atomic* obj ) | bool atomic_is_lock_free( const volatile Atomic* obj ) | ||
}} | }} | ||
− | {{dcl | + | {{dcl | 1= |
template< class Atomic > | template< class Atomic > | ||
bool atomic_is_lock_free( const Atomic* obj ) | bool atomic_is_lock_free( const Atomic* obj ) |
Revision as of 10:49, 23 September 2013
Defined in header <atomic>
|
||
(1) | (since C++11) | |
template< class Atomic > bool atomic_is_lock_free( const volatile Atomic* obj ) |
||
template< class Atomic > bool atomic_is_lock_free( const Atomic* obj ) |
||
#define ATOMIC_CHAR_LOCK_FREE /* unspecified */ #define ATOMIC_CHAR16_T_LOCK_FREE /* unspecified */ |
(2) | (since C++11) |
obj
is implemented lock-free, as if by calling obj->is_lock_free()Contents |
Parameters
obj | - | pointer to the atomic object to examine |
Return value
true if *obj is a lock-free atomic, false otherwise.
Exceptions
Notes
All atomic types except for std::atomic_flag may be implemented using mutexes or other locking operations, rather than using the lock-free atomic CPU instructions. Atomic types are also allowed to be sometimes lock-free, e.g. if only aligned memory accesses are naturally atomic on a given architecture, misaligned objects of the same type have to use locks. If the type is sometimes lock-free, then the function (1) or its member function equivalent has to be used to determine if the particular instance is lock-free.
Example
This section is incomplete Reason: no example |
See also
checks if the atomic object is lock-free (public member function of std::atomic<T> )
| |
specializes atomic operations for std::shared_ptr (function template) | |
(C++11) |
the lock-free boolean atomic type (class) |