aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/atomic_ops.txt12
1 files changed, 8 insertions, 4 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index 68542fe13b85..183e41bdcb69 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -7,12 +7,13 @@
7maintainers on how to implement atomic counter, bitops, and spinlock 7maintainers on how to implement atomic counter, bitops, and spinlock
8interfaces properly. 8interfaces properly.
9 9
10 The atomic_t type should be defined as a signed integer. 10 The atomic_t type should be defined as a signed integer and
11Also, it should be made opaque such that any kind of cast to a normal 11the atomic_long_t type as a signed long integer. Also, they should
12C integer type will fail. Something like the following should 12be made opaque such that any kind of cast to a normal C integer type
13suffice: 13will fail. Something like the following should suffice:
14 14
15 typedef struct { int counter; } atomic_t; 15 typedef struct { int counter; } atomic_t;
16 typedef struct { long counter; } atomic_long_t;
16 17
17Historically, counter has been declared volatile. This is now discouraged. 18Historically, counter has been declared volatile. This is now discouraged.
18See Documentation/volatile-considered-harmful.txt for the complete rationale. 19See Documentation/volatile-considered-harmful.txt for the complete rationale.
@@ -37,6 +38,9 @@ initializer is used before runtime. If the initializer is used at runtime, a
37proper implicit or explicit read memory barrier is needed before reading the 38proper implicit or explicit read memory barrier is needed before reading the
38value with atomic_read from another thread. 39value with atomic_read from another thread.
39 40
41As with all of the atomic_ interfaces, replace the leading "atomic_"
42with "atomic_long_" to operate on atomic_long_t.
43
40The second interface can be used at runtime, as in: 44The second interface can be used at runtime, as in:
41 45
42 struct foo { atomic_t counter; }; 46 struct foo { atomic_t counter; };