Fix READ_LOCK.

This commit is contained in:
Joao 2011-09-20 11:36:49 +01:00
parent f435f4871f
commit 7378b56289
3 changed files with 12 additions and 3 deletions

View File

@ -2145,6 +2145,7 @@ Yap_absmi(int inp)
PELOCK(9,ap);
DEC_CLREF_COUNT(cl);
fprintf(stderr,"%d %p=%lx\n",worker_id, cl, cl->ClRefCount);
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
if (erase) {
saveregs();

View File

@ -209,8 +209,10 @@ IsPrefixOp(Atom op,int *pptr, int *rpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Prefix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *rpptr = p & MaskPrio;
@ -239,8 +241,10 @@ IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Infix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *rpptr = *lpptr = p & MaskPrio;
@ -271,8 +275,10 @@ IsPosfixOp(Atom op, int *pptr, int *lpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Posfix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *lpptr = p & MaskPrio;

View File

@ -855,6 +855,7 @@ read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
LOCAL_HDiff = (char *)cl-base;
read_bytes(stream, cl, size);
INIT_LOCK(cl->ClLock);
RestoreDynamicClause(cl, pp);
Yap_AssertzClause(pp, cl->ClCode);
}
@ -927,6 +928,7 @@ read_ops(IOSTREAM *stream) {
op->Prefix = read_bits16(stream);
op->Infix = read_bits16(stream);
op->Posfix = read_bits16(stream);
WRITE_UNLOCK(op->OpRWLock);
}
}