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:
stasinos
2002-01-09 17:19:36 +00:00
parent 8496030d8a
commit 7849f7b54e
9 changed files with 89 additions and 7 deletions

View File

@@ -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.

View File

@@ -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),

View File

@@ -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) :-

View File

@@ -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), !,