be more careful to handle throws.
This commit is contained in:
parent
e6129e84b7
commit
f11eeb2967
@ -36,8 +36,8 @@ time_out(Goal, Time, Result) :-
|
|||||||
alarm(T.UT,throw(time_out),_),
|
alarm(T.UT,throw(time_out),_),
|
||||||
% launch goal and wait for signal
|
% launch goal and wait for signal
|
||||||
catch( run_goal(Goal, Result0),
|
catch( run_goal(Goal, Result0),
|
||||||
time_out,
|
Exception,
|
||||||
Result0 = time_out ),
|
handle_exception(Exception) ),
|
||||||
Result = Result0.
|
Result = Result0.
|
||||||
|
|
||||||
run_goal(Goal, Result0) :-
|
run_goal(Goal, Result0) :-
|
||||||
@ -63,9 +63,28 @@ run_goal(Goal, Result0) :-
|
|||||||
).
|
).
|
||||||
|
|
||||||
run_goal(_, _) :-
|
run_goal(_, _) :-
|
||||||
|
yap_hacks:disable_interrupts,
|
||||||
% make sure we're not getting an extraneous interrupt if we terminate early....
|
% make sure we're not getting an extraneous interrupt if we terminate early....
|
||||||
alarm(0,_,_),
|
alarm(0,_,_),
|
||||||
|
yap_hacks:enable_interrupts,
|
||||||
fail.
|
fail.
|
||||||
|
|
||||||
complete_time_out :-
|
complete_time_out :-
|
||||||
alarm(0,_,_).
|
yap_hacks:disable_interrupts,
|
||||||
|
alarm(0,_,_),
|
||||||
|
yap_hacks:enable_interrupts.
|
||||||
|
|
||||||
|
|
||||||
|
handle_exception(Exception) :-
|
||||||
|
yap_hacks:disable_interrupts,
|
||||||
|
(
|
||||||
|
Exception = time_out
|
||||||
|
->
|
||||||
|
yap_hacks:enable_interrupts,
|
||||||
|
Result0 = time_out
|
||||||
|
;
|
||||||
|
alarm(0,_,_),
|
||||||
|
yap_hacks:enable_interrupts,
|
||||||
|
throw(Exception)
|
||||||
|
).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user