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:
vsc 2008-04-04 10:02:44 +00:00
parent f930fd3179
commit 4c933b8d79
3 changed files with 9 additions and 7 deletions

View File

@ -1120,7 +1120,7 @@ catch(G, C, A) :-
%
throw(Ball) :-
% get this off the unwound computation.
copy_term(Ball,NewBall),
duplicate_term(Ball,NewBall),
% get current jump point
'$jump_env_and_store_ball'(NewBall).

View File

@ -11,8 +11,11 @@
* File: errors.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 $
* Revision 1.87 2008/03/17 12:08:28 vsc
* avoid silly message
*
* Revision 1.86 2008/02/23 01:32:31 vsc
* fix chr bootstrap.
*
@ -205,6 +208,9 @@
print_message(informational,abort(user)).
'$process_error'(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), _) :- !,
'$set_fpu_exceptions',
print_message(error,error(Msg, Where)).

View File

@ -319,11 +319,7 @@ thread_cancel(Id) :-
(Id == main; Id == 0), !,
'$do_error'(permission_error(cancel, thread, main), thread_cancel(Id)).
thread_cancel(Id) :-
'$check_thread_or_alias'(Id, thread_cancel(Id)),
'$thread_id_alias'(Id0, Id),
'$unlock_all_thread_mutexes'(Id0),
'$erase_thread_info'(Id0),
'$thread_destroy'(Id0).
thread_signal(Id, throw(error(thread_cancel(Id),thread_cancel(Id)))).
thread_detach(Id) :-
'$check_thread_or_alias'(Id, thread_detach(Id)),