1atomic_cas(3C) Standard C Library Functions atomic_cas(3C)
2
3
4
6 atomic_cas, atomic_cas_8, atomic_cas_uchar, atomic_cas_16,
7 atomic_cas_ushort, atomic_cas_32, atomic_cas_uint, atomic_cas_ulong,
8 atomic_cas_64, atomic_cas_ptr - atomic compare and swap operations
9
11 #include <atomic.h>
12
13 uint8_t atomic_cas_8(volatile uint8_t *target, uint8_t cmp,
14 uint8_t newval);
15
16
17 uchar_t atomic_cas_uchar(volatile uchar_t *target, uchar_t cmp,
18 uchar_t newval);
19
20
21 uint16_t atomic_cas_16(volatile uint16_t *target, uint16_t cmp,
22 uint16_t newval);
23
24
25 ushort_t atomic_cas_ushort(volatile ushort_t *target, ushort_t cmp,
26 ushort_t newval);
27
28
29 uint32_t atomic_cas_32(volatile uint32_t *target, uint32_t cmp,
30 uint32_t newval);
31
32
33 uint_t atomic_cas_uint(volatile uint_t *target, uint_t cmp,
34 uint_t newval);
35
36
37 ulong_t atomic_cas_ulong(volatile ulong_t *target, ulong_t cmp,
38 ulong_t newval);
39
40
41 uint64_t atomic_cas_64(volatile uint64_t *target, uint64_t cmp,
42 uint64_t newval);
43
44
45 void *atomic_cas_ptr(volatile void *target, void *cmp,
46 void *newval);
47
48
50 These functions enable a compare and swap operation to occur atomi‐
51 cally. The value stored in target is compared with cmp. If these values
52 are equal, the value stored in target is replaced with newval. The old
53 value stored in target is returned by the function whether or not the
54 replacement occurred.
55
57 These functions return the old value of *target.
58
60 No errors are defined.
61
63 See attributes(5) for descriptions of the following attributes:
64
65
66
67
68 ┌─────────────────────────────┬─────────────────────────────┐
69 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
70 ├─────────────────────────────┼─────────────────────────────┤
71 │Interface Stability │Committed │
72 ├─────────────────────────────┼─────────────────────────────┤
73 │MT-Level │MT-Safe │
74 └─────────────────────────────┴─────────────────────────────┘
75
77 atomic_add(3C), atomic_and(3C), atomic_bits(3C), atomic_dec(3C),
78 atomic_inc(3C), atomic_or(3C), atomic_swap(3C), membar_ops(3C),
79 attributes(5), atomic_ops(9F)
80
81
82
83SunOS 5.11 13 May 2005 atomic_cas(3C)