Unix and Linux Discussions Tagged with atomic |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
14 |
13,178 |
Programming |
|
|
|
1 |
5,727 |
Programming |
|
|
|
0 |
1,111 |
Software Releases - RSS News |
|
|
|
0 |
743 |
Software Releases - RSS News |
|
|
|
0 |
1,253 |
Software Releases - RSS News |
|
|
|
0 |
2,226 |
UNIX and Linux RSS News |
|
|
|
0 |
942 |
Software Releases - RSS News |
|
|
|
4 |
9,120 |
UNIX for Dummies Questions & Answers |
|
|
|
0 |
1,139 |
Software Releases - RSS News |
|
|
|
6 |
7,401 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
7,794 |
Programming |
|
|
|
1 |
11,686 |
Programming |
|
|
|
1 |
25,434 |
UNIX for Dummies Questions & Answers |
atomic_ops(9F) atomic_ops(9F)
NAME
atomic_ops - atomic operations
SYNOPSIS
#include <sys/atomic.h>
This collection of functions provides atomic memory operations. There are 8 different classes of atomic operations:
atomic_add(9F) These functions provide an atomic addition of a signed value to a variable.
atomic_and(9F) These functions provide an atomic logical 'and' of a value to a variable.
atomic_bits(9F) These functions provide atomic bit setting and clearing within a variable.
atomic_cas(9F) These functions provide an atomic comparison of a value with a variable. If the comparison is equal, then swap in a new
value for the variable, returning the old value of the variable in either case.
atomic_dec(9F) These functions provide an atomic decrement on a variable.
atomic_inc(9F) These functions provide an atomic increment on a variable.
atomic_or(9F) These functions provide an atomic logical 'or' of a value to a variable.
atomic_swap(9F) These functions provide an atomic swap of a value with a variable, returning the old value of the variable.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
atomic_add(9F), atomic_and(9F), atomic_bits(9F), atomic_cas(9F), atomic_dec(9F), atomic_inc(9F), atomic_or(9F), atomic_swap(9F), mem-
bar_ops(9F), attributes(5)
Atomic instructions ensure global visibility of atomically-modified variables on completion. In a relaxed store order system, this does
not guarantee that the visibility of other variables will be synchronized with the completion of the atomic instruction. If such synchro-
nization is required, memory barrier instructions must be used. See membar_ops(9F).
Atomic instructions can be expensive. since they require synchronization to occur at a hardware level. This means they should be used with
care to ensure that forcing hardware level synchronization occurs a minimum number of times. For example, if you have several variables
that need to be incremented as a group, and each needs to be done atomically, then do so with a mutex lock protecting all of them being
incremented rather than using the atomic_inc(9F) operation on each of them.
28 Mar 2005 atomic_ops(9F)