Added error checking code to the predicate thread_detach/1.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1761 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2006-12-31 22:23:24 +00:00
parent 9825556096
commit 0711088664
1 changed files with 16 additions and 1 deletions

View File

@ -237,8 +237,23 @@ thread_join(Id, Status) :-
'$erase_thread_aliases'(_).
thread_detach(Id) :-
'$check_thread_alias'(Id0,Id),
var(Id), !,
'$do_error'(instantiation_error,thread_detach(Id)).
thread_detach(Id) :-
\+ atom(Id),
\+ integer(Id),
'$do_error'(type_error(thread_or_alias, Id),thread_detach(Id)).
thread_detach(Id) :-
atom(Id),
recorded('$thread_alias',[Id0|Id],_),
'$valid_thread'(Id0), !,
'$detach_thread'(Id0).
thread_detach(Id) :-
integer(Id),
'$valid_thread'(Id), !,
'$detach_thread'(Id0).
thread_detach(Id) :-
'$do_error'(existence_error(thread, Id),thread_detach(Id)).
thread_exit(Term) :-
'$thread_self'(Id0),