From: Claudio Sacerdoti Coen Date: Tue, 3 Oct 2006 07:52:16 +0000 (+0000) Subject: The Abort button is now working properly. Cool. X-Git-Tag: 0.4.95@7852~947 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=aa0d55d15c7450f43797e15538ea029e19792e07;p=helm.git The Abort button is now working properly. Cool. --- diff --git a/matita/matitaGui.ml b/matita/matitaGui.ml index dcbbb6df4..85d72ebe0 100644 --- a/matita/matitaGui.ml +++ b/matita/matitaGui.ml @@ -433,13 +433,18 @@ class gui () = let kill_worker = (* the following lines are from Xavier Leroy: http://alan.petitepomme.net/cwn/2005.11.08.html *) let interrupt = ref None in + let old_callback = ref (function _ -> ()) in let force_interrupt n = (* This function is called just before the thread's timeslice ends *) + !old_callback n; if Some(Thread.id(Thread.self())) = !interrupt then (interrupt := None; raise Sys.Break) in -(* - let _ = Sys.signal Sys.sigvtalrm (Sys.Signal_handle force_interrupt) in -*) + let _ = + match Sys.signal Sys.sigvtalrm (Sys.Signal_handle force_interrupt) with + Sys.Signal_handle f -> old_callback := f + | Sys.Signal_ignore + | Sys.Signal_default -> assert false + in fun () -> match !worker_thread with None -> assert false