implement thread_cancel using signals
use duplicate_term instead of copy_term in throw: throw may lose reference to term. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2207 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
f930fd3179
commit
4c933b8d79
@ -1120,7 +1120,7 @@ catch(G, C, A) :-
|
|||||||
%
|
%
|
||||||
throw(Ball) :-
|
throw(Ball) :-
|
||||||
% get this off the unwound computation.
|
% get this off the unwound computation.
|
||||||
copy_term(Ball,NewBall),
|
duplicate_term(Ball,NewBall),
|
||||||
% get current jump point
|
% get current jump point
|
||||||
'$jump_env_and_store_ball'(NewBall).
|
'$jump_env_and_store_ball'(NewBall).
|
||||||
|
|
||||||
|
@ -11,8 +11,11 @@
|
|||||||
* File: errors.yap *
|
* File: errors.yap *
|
||||||
* comments: error messages for YAP *
|
* comments: error messages for YAP *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2008-03-17 12:08:28 $,$Author: vsc $ *
|
* Last rev: $Date: 2008-04-04 10:02:44 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.87 2008/03/17 12:08:28 vsc
|
||||||
|
* avoid silly message
|
||||||
|
*
|
||||||
* Revision 1.86 2008/02/23 01:32:31 vsc
|
* Revision 1.86 2008/02/23 01:32:31 vsc
|
||||||
* fix chr bootstrap.
|
* fix chr bootstrap.
|
||||||
*
|
*
|
||||||
@ -205,6 +208,9 @@
|
|||||||
print_message(informational,abort(user)).
|
print_message(informational,abort(user)).
|
||||||
'$process_error'(abort, _) :- !,
|
'$process_error'(abort, _) :- !,
|
||||||
throw('$abort').
|
throw('$abort').
|
||||||
|
'$process_error'(error(thread_cancel(Id), G),top) :- !.
|
||||||
|
'$process_error'(error(thread_cancel(Id), G), _) :- !,
|
||||||
|
throw(error(thread_cancel(Id), G)).
|
||||||
'$process_error'(error(Msg, Where), _) :- !,
|
'$process_error'(error(Msg, Where), _) :- !,
|
||||||
'$set_fpu_exceptions',
|
'$set_fpu_exceptions',
|
||||||
print_message(error,error(Msg, Where)).
|
print_message(error,error(Msg, Where)).
|
||||||
|
@ -319,11 +319,7 @@ thread_cancel(Id) :-
|
|||||||
(Id == main; Id == 0), !,
|
(Id == main; Id == 0), !,
|
||||||
'$do_error'(permission_error(cancel, thread, main), thread_cancel(Id)).
|
'$do_error'(permission_error(cancel, thread, main), thread_cancel(Id)).
|
||||||
thread_cancel(Id) :-
|
thread_cancel(Id) :-
|
||||||
'$check_thread_or_alias'(Id, thread_cancel(Id)),
|
thread_signal(Id, throw(error(thread_cancel(Id),thread_cancel(Id)))).
|
||||||
'$thread_id_alias'(Id0, Id),
|
|
||||||
'$unlock_all_thread_mutexes'(Id0),
|
|
||||||
'$erase_thread_info'(Id0),
|
|
||||||
'$thread_destroy'(Id0).
|
|
||||||
|
|
||||||
thread_detach(Id) :-
|
thread_detach(Id) :-
|
||||||
'$check_thread_or_alias'(Id, thread_detach(Id)),
|
'$check_thread_or_alias'(Id, thread_detach(Id)),
|
||||||
|
Reference in New Issue
Block a user