package sqlexpr

  1. Overview
  2. Docs

Identity concurrency monad. Note that Id.mutex is a dummy type that * doesn't actually work like a mutex (i.e., Id.with_lock m f is equivalent * to f (). This is so because in ocaml-sqlexpr's context Sqlite handles * can only be used from the thread where they were created, so there's no * need for mutual exclusion because trying to use the same handle from * different threads would be an error anyway.

type 'a t = 'a
val return : 'a -> 'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val try_bind : (unit -> 'a t) -> ('a -> 'b t) -> (exn -> 'b t) -> 'b t
val fail : exn -> 'a t
val catch : (unit -> 'a t) -> (exn -> 'a t) -> 'a t
val finalize : (unit -> 'a t) -> (unit -> unit t) -> 'a t
val sleep : float -> unit t
val auto_yield : float -> unit -> unit t
val backtrace_bind : (exn -> exn) -> 'a t -> ('a -> 'b t) -> 'b t
val backtrace_catch : (exn -> exn) -> (unit -> 'a t) -> (exn -> 'a t) -> 'a t
val backtrace_finalize : (exn -> exn) -> (unit -> 'a t) -> (unit -> unit t) -> 'a t
val backtrace_try_bind : (exn -> exn) -> (unit -> 'a t) -> ('a -> 'b t) -> (exn -> 'b t) -> 'b t
type mutex
val create_recursive_mutex : unit -> mutex

Create a recursive mutex that can be locked recursively by the same * thread; i.e., unlike a regular mutex, * with_lock m (fun () -> ... with_lock m (fun () -> ... )) * will not block.

val with_lock : mutex -> (unit -> 'a t) -> 'a t
val register_finaliser : ('a -> unit t) -> 'a -> unit
include THREAD_LOCAL_STATE with type 'a t := 'a t with type 'a key = 'a Lwt.key
type 'a key = 'a Lwt.key
val new_key : unit -> 'a key
val get : 'a key -> 'a option
val with_value : 'a key -> 'a option -> (unit -> 'b t) -> 'b t
OCaml

Innovation. Community. Security.