make sure we reset global variables when exiting a thread
This commit is contained in:
parent
ae5bf4d6e7
commit
44f7e67394
@ -1285,6 +1285,8 @@ p_nb_getval(void)
|
|||||||
to = t;
|
to = t;
|
||||||
}
|
}
|
||||||
READ_UNLOCK(ge->GRWLock);
|
READ_UNLOCK(ge->GRWLock);
|
||||||
|
if (to == TermFoundVar)
|
||||||
|
return FALSE;
|
||||||
return Yap_unify(ARG2, to);
|
return Yap_unify(ARG2, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ static void
|
|||||||
kill_thread_engine (int wid, int always_die)
|
kill_thread_engine (int wid, int always_die)
|
||||||
{
|
{
|
||||||
Prop p0 = AbsPredProp(Yap_heap_regs->thread_handle[wid].local_preds);
|
Prop p0 = AbsPredProp(Yap_heap_regs->thread_handle[wid].local_preds);
|
||||||
|
GlobalEntry *gl = GlobalVariables;
|
||||||
|
|
||||||
/* kill all thread local preds */
|
/* kill all thread local preds */
|
||||||
while(p0) {
|
while(p0) {
|
||||||
@ -114,6 +115,10 @@ kill_thread_engine (int wid, int always_die)
|
|||||||
Yap_Abolish(ap);
|
Yap_Abolish(ap);
|
||||||
Yap_FreeCodeSpace((char *)ap);
|
Yap_FreeCodeSpace((char *)ap);
|
||||||
}
|
}
|
||||||
|
while (gl) {
|
||||||
|
gl->global = TermFoundVar;
|
||||||
|
gl = gl->NextGE;
|
||||||
|
}
|
||||||
Yap_KillStacks(wid);
|
Yap_KillStacks(wid);
|
||||||
Yap_heap_regs->wl[wid].active_signals = 0L;
|
Yap_heap_regs->wl[wid].active_signals = 0L;
|
||||||
free(Yap_heap_regs->wl[wid].scratchpad.ptr);
|
free(Yap_heap_regs->wl[wid].scratchpad.ptr);
|
||||||
|
Reference in New Issue
Block a user