diff --git a/C/absmi.c b/C/absmi.c index e335b3a55..c281a9310 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -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(); diff --git a/C/parser.c b/C/parser.c index 2a43177fd..9bfc6847c 100644 --- a/C/parser.c +++ b/C/parser.c @@ -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; diff --git a/C/qlyr.c b/C/qlyr.c index acd6ada0a..cdb5550ba 100644 --- a/C/qlyr.c +++ b/C/qlyr.c @@ -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); } }