12345678910111213141516171819202122232425262728293031323334(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy and Pascal Cuoq, INRIA Rocquencourt *)(* *)(* Copyright 1995 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)typetexternalcreate:unit->t="caml_ml_mutex_new"externallock:t->unit="caml_ml_mutex_lock"externaltry_lock:t->bool="caml_ml_mutex_try_lock"externalunlock:t->unit="caml_ml_mutex_unlock"(* private re-export *)externalreraise:exn->'a="%reraise"(* cannot inline, otherwise flambda might move code around. *)let[@inlinenever]protectmf=lockm;matchf()with|x->unlockm;x|exceptione->(* NOTE: [unlock] does not poll for asynchronous exceptions *)unlockm;reraisee