From aa0d55d15c7450f43797e15538ea029e19792e07 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Tue, 3 Oct 2006 07:52:16 +0000 Subject: [PATCH] The Abort button is now working properly. Cool. --- matita/matitaGui.ml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 -- 2.39.2