package gapi-ocaml

  1. Overview
  2. Docs
A simple OCaml client for Google Services

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.4.9.tar.gz
sha256=e189067f3caf58235eee7f3f1b0f051d0192cd012e444c87492b2b502ad7c29c
md5=0f0c17b713f86d91d6be8ddf4a741745

doc/gapi-ocaml.netsys-local/Netsys_oothr/index.html

Module Netsys_oothrSource

Object-oriented thread API

Makes the most important multi-threading primitives available using object types. For single-threaded apps, the operations are substituted by no-ops.

Sourceclass type mtprovider = object ... end
Sourceclass type thread = object ... end
Sourceclass type mutex = object ... end
Sourceclass type condition = object ... end
Sourceval provider : mtprovider ref

Return the multi-threading provider

Sourceval serialize : mutex -> ('a -> 'b) -> 'a -> 'b

serialize m f arg: Locks m, runs f arg, unlocks m, and returns the result.

Sourceval atomic_init : 'a option ref -> 'a -> 'a

atomic_init var new_value: If the variable var is None, it is set to Some new_value, and new_value is returned. If it is Some old_value, then old_value is returned. The operation is atomic.

This function works independently of the provider.

Sourceval compare_and_swap : 'a ref -> 'a -> 'a -> bool

compare_and_swap var old_value new_value: If the variable var is physically identical to old_value it is atomically set to new_value, and true is returned. Otherwise, var is not assigned, and false is returned.

This function works independently of the provider.