Fixed two bugs when closing a thread: (1) register thread exit status before running the exit hooks; (2) incorrect register of exception exit status.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2197 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
f827e047c1
commit
5d6ddc8026
@ -53,22 +53,21 @@
|
|||||||
|
|
||||||
|
|
||||||
'$close_thread'('$thread_finished'(Status), Detached, Id0) :- !,
|
'$close_thread'('$thread_finished'(Status), Detached, Id0) :- !,
|
||||||
|
recorda('$thread_exit_status', [Id0|Status], _),
|
||||||
'$run_at_thread_exit'(Id0),
|
'$run_at_thread_exit'(Id0),
|
||||||
( Detached == true ->
|
( Detached == true ->
|
||||||
'$erase_thread_info'(Id0)
|
'$erase_thread_info'(Id0)
|
||||||
; recorda('$thread_exit_status', [Id0|Status], _)
|
; true
|
||||||
).
|
).
|
||||||
% format(user_error,'closing thread ~w~n',[v([Id0|Status])]).
|
% format(user_error,'closing thread ~w~n',[v([Id0|Status])]).
|
||||||
'$close_thread'(Exception, Detached, Id0) :-
|
'$close_thread'(Exception, Detached, Id0) :-
|
||||||
|
( recorded('$thread_exit_status',[Id0|_],R), erase(R), fail
|
||||||
|
; recorda('$thread_exit_status', [Id0|exception(error(Exception,_))])
|
||||||
|
),
|
||||||
'$run_at_thread_exit'(Id0),
|
'$run_at_thread_exit'(Id0),
|
||||||
( Detached == true ->
|
( Detached == true ->
|
||||||
'$erase_thread_info'(Id0)
|
'$erase_thread_info'(Id0)
|
||||||
;
|
; true
|
||||||
(
|
|
||||||
recorded('$thread_exit_status',[Id|_],R), erase(R), fail
|
|
||||||
;
|
|
||||||
recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal,Id)))])
|
|
||||||
)
|
|
||||||
).
|
).
|
||||||
|
|
||||||
thread_create(Goal) :-
|
thread_create(Goal) :-
|
||||||
|
Reference in New Issue
Block a user