diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-10-19 15:05:22 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-11-13 13:34:54 -0500 |
commit | 1f7870dd8729c64b8472b42440811e7ff94d16a4 (patch) | |
tree | ec1ab48f51ecb4846b380bf29b94e65b9e2138d4 /Documentation/atomic_ops.txt | |
parent | 8b19d1dead8413442ba0ff0b4e19b08f69d2f1b7 (diff) |
documentation: Add atomic_long_t to atomic_ops.txt
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
Diffstat (limited to 'Documentation/atomic_ops.txt')
-rw-r--r-- | Documentation/atomic_ops.txt | 12 |
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 @@ | |||
7 | maintainers on how to implement atomic counter, bitops, and spinlock | 7 | maintainers on how to implement atomic counter, bitops, and spinlock |
8 | interfaces properly. | 8 | interfaces 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 |
11 | Also, it should be made opaque such that any kind of cast to a normal | 11 | the atomic_long_t type as a signed long integer. Also, they should |
12 | C integer type will fail. Something like the following should | 12 | be made opaque such that any kind of cast to a normal C integer type |
13 | suffice: | 13 | will 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 | ||
17 | Historically, counter has been declared volatile. This is now discouraged. | 18 | Historically, counter has been declared volatile. This is now discouraged. |
18 | See Documentation/volatile-considered-harmful.txt for the complete rationale. | 19 | See 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 | |||
37 | proper implicit or explicit read memory barrier is needed before reading the | 38 | proper implicit or explicit read memory barrier is needed before reading the |
38 | value with atomic_read from another thread. | 39 | value with atomic_read from another thread. |
39 | 40 | ||
41 | As with all of the atomic_ interfaces, replace the leading "atomic_" | ||
42 | with "atomic_long_" to operate on atomic_long_t. | ||
43 | |||
40 | The second interface can be used at runtime, as in: | 44 | The second interface can be used at runtime, as in: |
41 | 45 | ||
42 | struct foo { atomic_t counter; }; | 46 | struct foo { atomic_t counter; }; |