more fixes for multi-threading.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1008 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-02-28 01:08:59 +00:00
parent 1f6fafc6a0
commit 02ec294d84
2 changed files with 16 additions and 9 deletions

View File

@ -6365,16 +6365,20 @@ Yap_absmi(int inp)
ASP = (CELL *) B;
}
#if defined(YAPOR) || defined(THREADS)
LOCK(pe->PELock);
if (*PREG_ADDR != PREG) {
PREG = *PREG_ADDR;
UNLOCK(pe->PELock);
JMPNext();
}
if (PP == NULL) {
READ_LOCK(pe->PRWLock);
PP = pe;
}
LOCK(pe->PELock);
if (*PREG_ADDR != PREG) {
PREG = *PREG_ADDR;
if (pe->PredFlags & (ThreadLocalPredFlag|LogUpdatePredFlag)) {
READ_UNLOCK(pe->PRWLock);
PP = NULL;
}
UNLOCK(pe->PELock);
JMPNext();
}
#endif
saveregs();
pt0 = Yap_ExpandIndex(pe);
@ -6382,6 +6386,12 @@ Yap_absmi(int inp)
setregs();
UNLOCK(pe->PELock);
PREG = pt0;
#if defined(YAPOR) || defined(THREADS)
if (pe->PredFlags & (ThreadLocalPredFlag|LogUpdatePredFlag)) {
READ_UNLOCK(pe->PRWLock);
PP = NULL;
}
#endif
JMPNext();
}
ENDBOp();

View File

@ -4278,9 +4278,6 @@ Yap_ExpandIndex(PredEntry *ap) {
static path_stack_entry *
push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp)
{
if (Yap_Option['i' - 'a' + 1]) {
printf("+ %p=>%p\n",sp,sp+1);
}
sp->flag = pc_entry;
sp->u.pce.pi_pc = pipc;
sp->u.pce.code = clp->Code;