From f827e047c1926c5325e8828c02e35297051158e7 Mon Sep 17 00:00:00 2001 From: pmoura Date: Thu, 3 Apr 2008 00:10:04 +0000 Subject: [PATCH] Fixed bug in the thread_create/3 predicate where the thread indentifer was not within scope of the at_exit/1 option. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2196 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- pl/threads.yap | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pl/threads.yap b/pl/threads.yap index 3be006e42..efd92b72f 100644 --- a/pl/threads.yap +++ b/pl/threads.yap @@ -87,7 +87,7 @@ thread_create(Goal) :- recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal,Id)))],_) ). -thread_create(Goal, OutId) :- +thread_create(Goal, Id) :- G0 = thread_create(Goal, Id), '$check_callable'(Goal, G0), ( nonvar(Id) -> '$do_error'(type_error(variable,Id),G0) ; true ), @@ -102,10 +102,9 @@ thread_create(Goal, OutId) :- true ; recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal,Id)))],_) - ), - OutId = Id. + ). -thread_create(Goal, OutId, Options) :- +thread_create(Goal, Id, Options) :- G0 = thread_create(Goal, Id, Options), '$check_callable'(Goal,G0), ( nonvar(Id) -> '$do_error'(type_error(variable,Id),G0) ; true ), @@ -123,8 +122,7 @@ thread_create(Goal, OutId, Options) :- true ; recorda('$thread_exit_status', [Id|exception(error(resource_error(memory),thread_create(Goal,Id,Options)))],_) - ), - OutId = Id. + ). '$erase_thread_info'(Id) :- recorded('$thread_exit_status', [Id|_], R),