Module Loc.Shared
val unsafe_of_atomic_loc :
('a : value_or_null). 'a Stdlib.Atomic.Loc.t @ local ->
'a Portable_kernel.Subatomic.Loc.t @ localLike Subatomic.Loc.unsafe_of_atomic_loc, but for shared values.
include sig ... end
val get :
('a : value_or_null). 'a Portable_kernel.Subatomic.Loc.t @ local local ->
'a @ localRead the current value of a subatomic.
getperforms a non-atomic read on an uncontended subatomic.get [@synchro atomic]andShared.getperform an atomic read on a shared subatomic.
val set : 'a. 'a Portable_kernel.Subatomic.Loc.t @ local local -> 'a -> unitUpdate the current value of a subatomic.
setperforms a non-atomic write on an uncontended subatomic.set [@synchro atomic]andShared.setperform an atomic write on a shared subatomic.
val exchange : 'a. 'a Portable_kernel.Subatomic.Loc.t @ local local -> 'a -> 'aUpdate the current value of a subatomic, and return the previous value.
updateperforms a non-atomic read/write on an uncontended subatomic.update [@synchro atomic]andShared.updateperform an atomic read/write on a shared subatomic.
val compare_and_set :
'a. 'a Portable_kernel.Subatomic.Loc.t @ local local ->
if_phys_equal_to:'a ->
replace_with:'a ->
Portable_kernel.Atomic.Compare_failed_or_set_here.tIf the current value of the subatomic is phys_equal to if_phys_equal, then update it to replace_with and return Set_here; otherwise, return Compare_failed (with the subatomic left unchanged).
compare_and_setperforms a non-atomic read/compare/write on an uncontended subatomic.compare_and_set [@synchro atomic]andShared.compare_and_setperform an atomic read/compare/write on a shared subatomic.
val compare_exchange :
'a. 'a Portable_kernel.Subatomic.Loc.t @ local local ->
if_phys_equal_to:'a ->
replace_with:'a ->
'aIf the current value of the subatomic is phys_equal to if_phys_equal, then update it to replace_with and return the previous value; otherwise, return current (unchanged) value.
compare_exchangeperforms a non-atomic read/compare/write on an uncontended subatomic.compare_exchange [@synchro atomic]andShared.compare_exchangeperform an atomic read/compare/write on a shared subatomic.
val update :
'a. 'a Portable_kernel.Subatomic.Loc.t @ local local ->
pure_f:('a -> 'a) @ local ->
unitUpdate t to be the result of pure_f (get t); if t is changed before the whole operation is complete, retry until success. pure_f may be called multiple times, so should be free of side effects.
updateperforms a non-atomic read/compare/write on an uncontended subatomic.pure_fstill may be called multiple times due to nonportable threading or ifpure_fis not actually pure.update [@synchro atomic]andShared.updateperform an atomic read/compare/write on a shared subatomic.
val get_and_update :
'a. 'a Portable_kernel.Subatomic.Loc.t @ local local ->
pure_f:('a -> 'a) @ local ->
'aUpdate t to be the result of pure_f (get t), and return the old value; if t is changed before the whole operation is complete, retry until success. pure_f may be called multiple times, so should be free of side effects.
get_and_updateperforms a non-atomic read/compare/write on an uncontended subatomic.pure_fstill may be called multiple times due to nonportable threading or ifpure_fis not actually pure.get_and_update [@synchro atomic]andShared.get_and_updateperform an atomic read/compare/write on a shared subatomic.
val fetch_and_add :
int Portable_kernel.Subatomic.Loc.t @ local local ->
int ->
intIncrements the value of a subatomic by the given value, and return the previous value (before the increment).
fetch_and_addperforms a non-atomic update on an uncontended subatomic.fetch_and_add [@synchro atomic]andShared.fetch_and_addperform an atomic update on a shared subatomic.
val add : int Portable_kernel.Subatomic.Loc.t @ local local -> int -> unitAdd the given value to the subatomic.
addperforms a non-atomic update on an uncontended subatomic.add [@synchro atomic]andShared.addperform an atomic update on a shared subatomic.
val sub : int Portable_kernel.Subatomic.Loc.t @ local local -> int -> unitSubtract the given value from the subatomic.
subperforms a non-atomic update on an uncontended subatomic.sub [@synchro atomic]andShared.subperform an atomic update on a shared subatomic.
val logand : int Portable_kernel.Subatomic.Loc.t @ local local -> int -> unitApply bitwise-and of the given value to the subatomic.
logandperforms a non-atomic update on an uncontended subatomic.logand [@synchro atomic]andShared.logandperform an atomic update on a shared subatomic.
val logor : int Portable_kernel.Subatomic.Loc.t @ local local -> int -> unitApply bitwise-or of the given value to the subatomic.
logorperforms a non-atomic update on an uncontended subatomic.logor [@synchro atomic]andShared.logorperform an atomic update on a shared subatomic.
val logxor : int Portable_kernel.Subatomic.Loc.t @ local local -> int -> unitApply bitwise-xor of the given value to the subatomic.
logxorperforms a non-atomic update on an uncontended subatomic.logxor [@synchro atomic]andShared.logxorperform an atomic update on a shared subatomic.
val incr : int Portable_kernel.Subatomic.Loc.t @ local local -> unitIncrement a subatomic by 1.
incrperforms a non-atomic update on an uncontended subatomic.incr [@synchro atomic]andShared.incrperform an atomic update on a shared subatomic.
val decr : int Portable_kernel.Subatomic.Loc.t @ local local -> unitDecrement a subatomic by 1.
decrperforms a non-atomic update on an uncontended subatomic.decr [@synchro atomic]andShared.decrperform an atomic update on a shared subatomic.