protect dead threads.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@995 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-02-17 19:29:24 +00:00
parent 3ecc66b7fd
commit 6031b7f049
1 changed files with 4 additions and 0 deletions

View File

@ -361,6 +361,10 @@ p_thread_signal(void)
Int wid = IntegerOfTerm(Deref(ARG1));
/* make sure the lock is available */
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
if (!ThreadHandle[wid].in_use) {
pthread_mutex_unlock(&(ThreadHandle[wid].tlock));
return TRUE;
}
LOCK(heap_regs->wl[wid].signal_lock);
ThreadHandle[wid].current_yaam_regs->CreepFlag_ = Unsigned(LCL0);
heap_regs->wl[wid].active_signals |= YAP_ITI_SIGNAL;