@ -76,19 +76,23 @@ let timeout_action _ =
raise ( SymOp . Analysis_failure_exe FKtimeout )
raise ( SymOp . Analysis_failure_exe FKtimeout )
let () =
let register_timeout_handlers =
(* Can't use Core since it wraps signal handlers and alarms with catch-all exception handlers that
let already_registered = ref false in
exit , while we need to propagate the timeout exceptions . * )
fun () ->
let module Gc = Caml . Gc in
if not ! already_registered then (
let module Sys = Caml . Sys in
already_registered := true ;
match Config . os_type with
(* Can't use Core since it wraps signal handlers and alarms with catch-all exception handlers
| Config . Unix | Config . Cygwin ->
that exit , while we need to propagate the timeout exceptions . * )
Sys . set_signal Sys . sigvtalrm ( Sys . Signal_handle timeout_action ) ;
let module Gc = Caml . Gc in
Sys . set_signal Sys . sigalrm ( Sys . Signal_handle timeout_action )
let module Sys = Caml . Sys in
| Config . Win32 ->
match Config . os_type with
SymOp . set_wallclock_timeout_handler timeout_action ;
| Config . Unix | Config . Cygwin ->
(* use the Gc alarm for periodic timeout checks *)
Sys . set_signal Sys . sigvtalrm ( Sys . Signal_handle timeout_action ) ;
ignore ( Gc . create_alarm SymOp . check_wallclock_alarm )
Sys . set_signal Sys . sigalrm ( Sys . Signal_handle timeout_action )
| Config . Win32 ->
SymOp . set_wallclock_timeout_handler timeout_action ;
(* use the Gc alarm for periodic timeout checks *)
ignore ( Gc . create_alarm SymOp . check_wallclock_alarm ) )
let unwind () =
let unwind () =
@ -109,6 +113,7 @@ let resume_previous_timeout () =
let exe_timeout f x =
let exe_timeout f x =
register_timeout_handlers () ;
let suspend_existing_timeout_and_start_new_one () =
let suspend_existing_timeout_and_start_new_one () =
suspend_existing_timeout ~ keep_symop_total : true ;
suspend_existing_timeout ~ keep_symop_total : true ;
Option . iter ( SymOp . get_timeout_seconds () ) ~ f : set_alarm ;
Option . iter ( SymOp . get_timeout_seconds () ) ~ f : set_alarm ;