12345678910111213141516171819202122232425262728293031323334353637(**************************************************************************)(* *)(* 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. *)(* *)(**************************************************************************)typet:sync_dataexternalcreate:unit->t@@portable="caml_ml_mutex_new"externallock:t@local->unit@@portable="caml_ml_mutex_lock"externaltry_lock:t@local->bool@@portable="caml_ml_mutex_try_lock"externalunlock:t@local->unit@@portable="caml_ml_mutex_unlock"(* private re-export *)externalreraise:exn->'a@@portable="%reraise"typenothing=|(* 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;match(reraisee)with|(_:nothing)->.