package ocaml_intrinsics

  1. Overview
  2. Docs

Module Atomic.Native_pointerSource

fetch_and_$op_$type ptr val atomically runs *( *$type )ptr $op val, stores the result at ptr, and returns the original value at ptr.

compare_and_swap_$type ptr ~compare_with ~set_to atomically checks if the value at ptr is equal to compare_with: if so, it stores set_to to ptr and returns true, otherwise returns false

Pointer to untagged int

Sourceval fetch_and_add : Native_pointer.t -> int -> int
Sourceval fetch_and_sub : Native_pointer.t -> int -> int
Sourceval compare_and_swap : Native_pointer.t -> compare_with:int -> set_to:int -> bool

Pointer to unboxed int64

Sourceval fetch_and_add_int64 : Native_pointer.t -> int64 -> int64
Sourceval fetch_and_sub_int64 : Native_pointer.t -> int64 -> int64
Sourceval compare_and_swap_int64 : Native_pointer.t -> compare_with:int64 -> set_to:int64 -> bool

Pointer to unboxed int32

Sourceval fetch_and_add_int32 : Native_pointer.t -> int32 -> int32
Sourceval fetch_and_sub_int32 : Native_pointer.t -> int32 -> int32
Sourceval compare_and_swap_int32 : Native_pointer.t -> compare_with:int32 -> set_to:int32 -> bool

Pointer to unboxed nativeint

Sourceval fetch_and_add_nativeint : Native_pointer.t -> nativeint -> nativeint
Sourceval fetch_and_sub_nativeint : Native_pointer.t -> nativeint -> nativeint
Sourceval compare_and_swap_nativeint : Native_pointer.t -> compare_with:nativeint -> set_to:nativeint -> bool
OCaml

Innovation. Community. Security.