package async_extended

  1. Overview
  2. Docs
module Handle : sig ... end

Handle is something you get when you acquire a resource and you use the handle to release the resource.

type ('a, 'e) t
val create : (unit -> ('a * Handle.t, 'e) Core.Result.t Async_kernel.Deferred.t) -> ('a, 'e) t

acquire and Handle.release are the low-level interface to accessing the resource. These should be used carefully: to make sure you do not resource leak you need to call Handle.release at least once on every handle returned by acquire. To ensure safety you also must stop using the 'a after having called release on a corresponding handle.

create is the low-level way of creating resources. Think of create and acquire as inverses: create wraps the resource implementation and acquire exposes it: 1. acquire (create f) = f () 2. create (fun () -> acquire r) = r

val acquire : ('a, 'e) t -> ('a * Handle.t, 'e) Core.Result.t Async_kernel.Deferred.t
OCaml

Innovation. Community. Security.