SIG_USR handling seems to be working
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@282 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
11
pl/boot.yap
11
pl/boot.yap
@@ -94,6 +94,17 @@ true :- true. % otherwise, $$compile will ignore this clause.
|
||||
'$enter_top_level' :-
|
||||
'$alarm'(0, _),
|
||||
fail.
|
||||
% set the default user signal handlers
|
||||
'$enter_top_level' :-
|
||||
( '$recorded'('$sig_handler',_,_) ->
|
||||
true
|
||||
;
|
||||
'$recordz'('$sig_handler',
|
||||
action(sig_usr1,(format('Received user signal 1~n',[]),halt)), _),
|
||||
'$recordz'('$sig_handler',
|
||||
action(sig_usr2,(format('Received user signal 2~n',[]),halt)), _)
|
||||
),
|
||||
fail.
|
||||
'$enter_top_level' :-
|
||||
'$clean_up_dead_clauses',
|
||||
fail.
|
||||
|
11
pl/debug.yap
11
pl/debug.yap
@@ -739,6 +739,17 @@ debugging :-
|
||||
true
|
||||
),
|
||||
'$execute'(M:Goal).
|
||||
'$creep'(G) :-
|
||||
'$get_value'('$sig_pending', Signal),
|
||||
\+ Signal = [], !,
|
||||
'$set_value'('$sig_pending', []),
|
||||
( '$recorded'('$sig_handler', action(Signal,A),_) ->
|
||||
'$execute'(A),
|
||||
G=[M|Goal]
|
||||
;
|
||||
true
|
||||
),
|
||||
'$execute'(M:Goal).
|
||||
'$creep'(_) :-
|
||||
'$get_value'('$throw', true), !,
|
||||
'$set_value'('$throw', false),
|
||||
|
@@ -91,7 +91,7 @@ setof(Template, Generator, Set) :-
|
||||
% And this is bagof
|
||||
|
||||
% Either we have excess of variables
|
||||
% and we need to find the solutions for each instantion
|
||||
% and we need to find the solutions for each instantiation
|
||||
% of these variables
|
||||
|
||||
bagof(Template, Generator, Bag) :-
|
||||
|
@@ -231,6 +231,13 @@ alarm(Interval, Goal, Left) :-
|
||||
'$recordz'('$alarm_handler',M:Goal,_),
|
||||
'$alarm'(Interval, Left).
|
||||
|
||||
on_signal(Signal,OldAction,Action) :-
|
||||
recorded('$sig_handler', action(Signal,OldAction), Ref),
|
||||
erase(Ref),
|
||||
'$current_module'(M),
|
||||
'$recordz'('$sig_handler', action(Signal,M:Action),Ref2).
|
||||
|
||||
|
||||
%%% Saving and restoring a computation
|
||||
|
||||
save(A) :- var(A), !,
|
||||
|
Reference in New Issue
Block a user