more thread fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1655 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-05-25 17:35:49 +00:00
parent 1d445a731d
commit 51553d40f2
3 changed files with 3 additions and 7 deletions

View File

@ -294,7 +294,7 @@ Int
Yap_thread_detach_engine(int wid) Yap_thread_detach_engine(int wid)
{ {
pthread_mutex_lock(&(ThreadHandle[wid].tlock)); pthread_mutex_lock(&(ThreadHandle[wid].tlock));
if (ThreadHandle[wid].handle == worker_id) if (ThreadHandle[wid].handle == pthread_self())
ThreadHandle[wid].handle = 0; ThreadHandle[wid].handle = 0;
ThreadHandle[wid].ref_count--; ThreadHandle[wid].ref_count--;
pthread_mutex_unlock(&(ThreadHandle[wid].tlock)); pthread_mutex_unlock(&(ThreadHandle[wid].tlock));

View File

@ -16,6 +16,7 @@
<h2>Yap-5.1.2:</h2> <h2>Yap-5.1.2:</h2>
<ul> <ul>
<li> FIXED: termination info for failed and detached threads (obs Paulo Moura).</li>
<li> FIXED: check_callable should check for modules (obs Paulo Moura).</li> <li> FIXED: check_callable should check for modules (obs Paulo Moura).</li>
<li> NEW: add thread_sleep/1, mostly works like system:sleep/1 (request from Paulo Moura).</li> <li> NEW: add thread_sleep/1, mostly works like system:sleep/1 (request from Paulo Moura).</li>
<li> NEW: add select/3 and intersection/3 to SWI emulation.</li> <li> NEW: add select/3 and intersection/3 to SWI emulation.</li>

View File

@ -35,11 +35,6 @@
'$current_module'(Module), '$current_module'(Module),
'$system_catch'((G,'$close_thread'(Detached,true) ; '$close_thread'(Detached,false)),Module,Exception,'$thread_exception'(Exception,Detached)). '$system_catch'((G,'$close_thread'(Detached,true) ; '$close_thread'(Detached,false)),Module,Exception,'$thread_exception'(Exception,Detached)).
'$top_thread_goal'(_) :-
'$thread_self'(Id0),
recorda('$thread_exit_status', [Id0|false], _),
'$run_at_thread_exit'(Id0).
'$close_thread'(Detached, Status) :- '$close_thread'(Detached, Status) :-
'$thread_self'(Id0), '$thread_self'(Id0),
(Detached == true -> (Detached == true ->
@ -209,7 +204,7 @@ thread_detach(Id) :-
thread_exit(Term) :- thread_exit(Term) :-
'$thread_self'(Id0), '$thread_self'(Id0),
'$run_at_thread_exit'(Id0), '$run_at_thread_exit'(Id0),
recorda('$thread_exit_status', [Id0|Term], _), recorda('$thread_exit_status', [Id0|exited(Term)], _),
'$thread_exit'. '$thread_exit'.
'$run_at_thread_exit'(Id0) :- '$run_at_thread_exit'(Id0) :-