package luv

  1. Overview
  2. Docs
Binding to libuv: cross-platform asynchronous I/O

Install

Dune Dependency

Authors

Maintainers

Sources

luv-0.5.9.tar.gz
sha256=a2fa91083bc71ce2ee70710d8f9d9b3635620774e5a917ec72b696fd36127b2d
md5=e19f39296b426215e0c21d3a7f8fe272

doc/src/luv/once.ml.html

Source file once.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(* This file is part of Luv, released under the MIT license. See LICENSE.md for
   details, or visit https://github.com/aantron/luv/blob/master/LICENSE.md. *)



type t = C.Types.Once.t Ctypes.ptr

let init () =
  let guard = Ctypes.addr (Ctypes.make C.Types.Once.t) in
  C.Functions.Once.init guard
  |> Error.to_result guard

let trampoline =
  C.Functions.Once.get_trampoline ()

external set_callback : (unit -> unit) -> unit = "luv_set_once_callback"

let once guard f =
  set_callback f;
  C.Functions.Once.once guard trampoline

let once_c guard f =
  C.Functions.Once.once guard (Ctypes.funptr_of_raw_address f)
OCaml

Innovation. Community. Security.