Module Luv.Semaphore

Semaphores.

See Semaphores in libuv.

type t

Binds uv_sem_t.

val init : int -> (t, Error.t) Stdlib.result

Allocates and initializes a semaphore.

Binds uv_sem_init. See sem_init(3p).

val destroy : t -> unit

Cleans up a semaphore.

Binds uv_sem_destroy. See sem_destroy(3p).

val post : t -> unit

Increments a semaphore.

Binds uv_sem_post. See sem_post(3p).

val wait : t -> unit

Decrements a semaphore.

Binds uv_sem_wait. See sem_wait(3p).

val trywait : t -> (unit, Error.t) Stdlib.result

Tries to decrement a semaphore without blocking.

Binds uv_sem_trywait. See sem_trywait(3p).