Luv.TLS
Thread-local storage.
See Thread-local storage in libuv.
The interface is currently written in terms of nativeint
, the type of pointer-sized raw values. You can store OCaml values in TLS by manipulating and registering them with the GC using Ctypes.Root
. The conversions between unit ptr
and nativeint
are Ctypes.ptr_of_raw_address
and Ctypes.raw_address_of_ptr
.
A future version of this API is likely to handle GC roots internally, and be directly usable with OCaml values.
Binds uv_key_t
.
Creates a TLS key.
Binds uv_key_create
. See pthread_key_create(3p)
.
val delete : t -> unit
Deletes a TLS key.
Binds uv_key_delete
. See pthread_key_delete(3p)
.
val get : t -> nativeint
Retrieves the value at a TLS key.
Binds uv_key_get
. See pthread_getspecific(3p)
.
val set : t -> nativeint -> unit
Sets the value at a TLS key.
Binds uv_key_set
. See pthread_setspecific(3p)
.