make sure we reset global variables when exiting a thread

This commit is contained in:
Vitor Santos Costa 2009-05-17 10:38:39 -07:00
parent ae5bf4d6e7
commit 44f7e67394
2 changed files with 7 additions and 0 deletions

View File

@ -1285,6 +1285,8 @@ p_nb_getval(void)
to = t;
}
READ_UNLOCK(ge->GRWLock);
if (to == TermFoundVar)
return FALSE;
return Yap_unify(ARG2, to);
}

View File

@ -106,6 +106,7 @@ static void
kill_thread_engine (int wid, int always_die)
{
Prop p0 = AbsPredProp(Yap_heap_regs->thread_handle[wid].local_preds);
GlobalEntry *gl = GlobalVariables;
/* kill all thread local preds */
while(p0) {
@ -114,6 +115,10 @@ kill_thread_engine (int wid, int always_die)
Yap_Abolish(ap);
Yap_FreeCodeSpace((char *)ap);
}
while (gl) {
gl->global = TermFoundVar;
gl = gl->NextGE;
}
Yap_KillStacks(wid);
Yap_heap_regs->wl[wid].active_signals = 0L;
free(Yap_heap_regs->wl[wid].scratchpad.ptr);