Difference between revisions of "cpp/atomic/atomic is lock free"
m (link to shared) |
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh) |
||
Line 56: | Line 56: | ||
{{dcl list template | cpp/atomic/dcl list atomic_flag}} | {{dcl list template | cpp/atomic/dcl list atomic_flag}} | ||
{{dcl list end}} | {{dcl list end}} | ||
+ | |||
+ | [[de:cpp/atomic/atomic is lock free]] | ||
+ | [[es:cpp/atomic/atomic is lock free]] | ||
+ | [[fr:cpp/atomic/atomic is lock free]] | ||
+ | [[it:cpp/atomic/atomic is lock free]] | ||
+ | [[ja:cpp/atomic/atomic is lock free]] | ||
+ | [[pt:cpp/atomic/atomic is lock free]] | ||
+ | [[ru:cpp/atomic/atomic is lock free]] | ||
+ | [[zh:cpp/atomic/atomic is lock free]] |
Revision as of 16:10, 2 November 2012
Template:ddcl list begin <tr class="t-dsc-header">
<td><atomic>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td >bool atomic_is_lock_free(const volatile Atomic* obj)
<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">
<td >bool atomic_is_lock_free(const Atomic* obj)
<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">
<td >#define ATOMIC_CHAR16_T_LOCK_FREE /* unspecified */
#define ATOMIC_CHAR32_T_LOCK_FREE /* unspecified */
#define ATOMIC_WCHAR_T_LOCK_FREE /* unspecified */
#define ATOMIC_SHORT_LOCK_FREE /* unspecified */
#define ATOMIC_INT_LOCK_FREE /* unspecified */
#define ATOMIC_LONG_LOCK_FREE /* unspecified */
#define ATOMIC_LLONG_LOCK_FREE /* unspecified */
<td > (3) </td> <td > (since C++11) </td> </tr> Template:ddcl list end
1-2) Determines if the atomic object pointed to by obj
is implemented lock-free, as if by calling obj->is_lock_free()
3) Expands to an integer constant expression with value 0 for the built-in atomic types that are never lock-free, to 1 for the built-in atomic types that are sometimes lock-free, and to 2 for the built-in atomic types that are always lock-free.
Contents |
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-2) or its member function equivalent has to be used to determine if the particular instance is lock-free.
Parameters
obj | - | pointer to the atomic object to examine |
Return value
true if *obj is a lock-free atomic, false otherwise.
Exceptions
Example
This section is incomplete Reason: no example |
See also
specializes atomic operations for std::shared_ptr (function template) |