atomic.9: fix description of acquire and release
The ordering point is not the atomic operation itself, but the load for acquire or store for release done as part of the atomic. This does not matter for atomic_load_acq and atomic_store_rel, but does matter for RWM operations. Noted by: alc Reviewed by: markj Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52744
This commit is contained in:
+17
-10
@@ -182,35 +182,42 @@ This variant is the default.
|
||||
The second variant has acquire semantics, and the third variant has release
|
||||
semantics.
|
||||
.Pp
|
||||
When an atomic operation has acquire semantics, the operation must have
|
||||
An atomic operation can only have
|
||||
.Em acquire
|
||||
semantics if it performs a load
|
||||
from memory.
|
||||
When an atomic operation has acquire semantics, a load performed as
|
||||
part of the operation must have
|
||||
completed before any subsequent load or store (by program order) is
|
||||
performed.
|
||||
Conversely, acquire semantics do not require that prior loads or stores have
|
||||
completed before the atomic operation is performed.
|
||||
An atomic operation can only have acquire semantics if it performs a load
|
||||
from memory.
|
||||
completed before a load from the atomic operation is performed.
|
||||
To denote acquire semantics, the suffix
|
||||
.Dq Li _acq
|
||||
is inserted into the function name immediately prior to the
|
||||
.Dq Li _ Ns Aq Fa type
|
||||
suffix.
|
||||
For example, to subtract two integers ensuring that the subtraction is
|
||||
For example, to subtract two integers ensuring that the load of
|
||||
the value from memory is
|
||||
completed before any subsequent loads and stores are performed, use
|
||||
.Fn atomic_subtract_acq_int .
|
||||
.Pp
|
||||
An atomic operation can only have
|
||||
.Em release
|
||||
semantics if it performs a store to memory.
|
||||
When an atomic operation has release semantics, all prior loads or stores
|
||||
(by program order) must have completed before the operation is performed.
|
||||
Conversely, release semantics do not require that the atomic operation must
|
||||
(by program order) must have completed before a store executed as part of
|
||||
the operation that is performed.
|
||||
Conversely, release semantics do not require that a store from the atomic
|
||||
operation must
|
||||
have completed before any subsequent load or store is performed.
|
||||
An atomic operation can only have release semantics if it performs a store
|
||||
to memory.
|
||||
To denote release semantics, the suffix
|
||||
.Dq Li _rel
|
||||
is inserted into the function name immediately prior to the
|
||||
.Dq Li _ Ns Aq Fa type
|
||||
suffix.
|
||||
For example, to add two long integers ensuring that all prior loads and
|
||||
stores are completed before the addition is performed, use
|
||||
stores are completed before the store of the result is performed, use
|
||||
.Fn atomic_add_rel_long .
|
||||
.Pp
|
||||
When a release operation by one thread
|
||||
|
||||
Reference in New Issue
Block a user