5 (* We check first whether there are some event pending, and run
6 some iterations. We then need to delay, thus focing a thread switch. *)
10 let loop = (Glib.Main.create true) in
11 Main.loops := loop :: !Main.loops;
12 while Glib.Main.is_running loop do
14 while !i < 100 && Glib.Main.pending () do
15 Glib.Main.iteration true;
20 Main.loops := List.tl !Main.loops
22 Main.loops := List.tl !Main.loops;
25 let start = Thread.create main
28 let mutex = Mutex.create () in
30 GtkSignal.enter_callback :=
31 (fun () -> if !depth = 0 then Mutex.lock mutex; incr depth);
32 GtkSignal.exit_callback :=
33 (fun () -> decr depth; if !depth = 0 then Mutex.unlock mutex)