Fixed bug in the predicate thread_create/1 when the thread goal generates an exception.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2204 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2008-04-03 23:23:06 +00:00
parent 282ba60852
commit 04682ef5f0

View File

@ -1,18 +1,18 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: threads.yap * * File: threads.yap *
* Last rev: 8/2/88 * * Last rev: 8/2/88 *
* mods: * * mods: *
* comments: support threads * * comments: support threads *
* * * *
*************************************************************************/ *************************************************************************/
:- meta_predicate :- meta_predicate
@ -83,7 +83,7 @@ thread_create(Goal) :-
-> ->
true true
; ;
recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal,Id)))],_) recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal)))],_)
). ).
thread_create(Goal, Id) :- thread_create(Goal, Id) :-
@ -350,7 +350,7 @@ thread_exit(Term) :-
'$run_at_thread_exit'(Id0) :- '$run_at_thread_exit'(Id0) :-
recorded('$thread_at_exit',[Id0|AtExit],R), erase(R), recorded('$thread_at_exit',[Id0|AtExit],R), erase(R),
catch(once(AtExit),_,fail), catch(once(AtExit), _, fail),
fail. fail.
'$run_at_thread_exit'(Id0) :- '$run_at_thread_exit'(Id0) :-
recorded('$thread_exit_hook',[Id0|Hook],R), erase(R), recorded('$thread_exit_hook',[Id0|Hook],R), erase(R),