1 (***********************************************************************)
5 (* Xavier Leroy and Damien Doligez, INRIA Rocquencourt *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the GNU Library General Public License, with *)
10 (* the special exception on linking described in file ../../LICENSE. *)
12 (***********************************************************************)
14 (* $Id: condition.ml 4144 2001-12-07 13:41:02Z xleroy $ *)
16 type t = { mutable waiting: Thread.t list }
18 let create () = { waiting = [] }
21 Thread.critical_section := true;
23 cond.waiting <- Thread.self() :: cond.waiting;
28 match cond.waiting with (* atomic *)
30 | th :: rem -> cond.waiting <- rem (* atomic *); Thread.wakeup th
33 let w = cond.waiting in (* atomic *)
34 cond.waiting <- []; (* atomic *)
35 List.iter Thread.wakeup w