|
From: Vitor S. C. <vs...@us...> - 2008-08-08 16:05:01
|
Update of /cvsroot/yap/C In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16305/C Modified Files: threads.c Log Message: fix threads/0. Index: threads.c =================================================================== RCS file: /cvsroot/yap/C/threads.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- threads.c 8 Aug 2008 14:05:34 -0000 1.45 +++ threads.c 8 Aug 2008 16:05:10 -0000 1.46 @@ -479,7 +479,20 @@ static Int p_thread_detached(void) { - return Yap_unify(ARG1,ThreadHandle[worker_id].tdetach); + if (ThreadHandle[worker_id].tdetach) + return Yap_unify(ARG1,ThreadHandle[worker_id].tdetach); + else + return FALSE; +} + +static Int +p_thread_detached2(void) +{ + Int tid = IntegerOfTerm(Deref(ARG1)); + if (ThreadHandle[tid].tdetach) + return Yap_unify(ARG2,ThreadHandle[tid].tdetach); + else + return FALSE; } static Int @@ -820,6 +833,7 @@ Yap_InitCPred("thread_yield", 0, p_thread_yield, 0); Yap_InitCPred("$detach_thread", 1, p_thread_detach, HiddenPredFlag); Yap_InitCPred("$thread_detached", 1, p_thread_detached, HiddenPredFlag); + Yap_InitCPred("$thread_detached", 2, p_thread_detached2, HiddenPredFlag); Yap_InitCPred("$thread_exit", 0, p_thread_exit, HiddenPredFlag); Yap_InitCPred("thread_setconcurrency", 2, p_thread_set_concurrency, 0); Yap_InitCPred("$valid_thread", 1, p_valid_thread, HiddenPredFlag); |