Added the thread_create/1 built-in predicate specified in the ISO standardization proposal.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1904 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2007-06-19 10:55:35 +00:00
parent 6b4bde14e1
commit 50e39bef80
2 changed files with 18 additions and 0 deletions

View File

@ -10628,6 +10628,13 @@ data from their stacks.
Create a new Prolog thread using default options. See @code{thread_create/3}.
@item thread_create(:@var{Goal})
@findex thread_create/1
@snindex thread_create/1
@cnindex thread_create/1
Create a new Prolog detached thread using default options. See @code{thread_create/3}.
@item thread_self(-@var{Id})
@findex thread_self/1
@snindex thread_self/1

View File

@ -18,6 +18,7 @@
:- meta_predicate
thread_create(:,-,+),
thread_create(:,-),
thread_create(:),
thread_at_exit(:),
thread_signal(+,:),
with_mutex(+,:).
@ -57,6 +58,16 @@
),
'$run_at_thread_exit'(Id0).
thread_create(Goal) :-
G0 = thread_create(Goal),
'$check_callable'(Goal, G0),
'$thread_options'([detached(true)], [], Stack, Trail, System, Detached, G0),
'$thread_new_tid'(Id),
'$erase_thread_info'(Id),
'$record_thread_info'(Id, [Stack, Trail, System], true),
'$create_mq'(Id),
'$create_thread'(Goal, Stack, Trail, System, Detached, Id).
thread_create(Goal, Id) :-
G0 = thread_create(Goal, Id),
'$check_callable'(Goal, G0),