}
if (lockp->level != 0) {
+ int found = 0;
lockRefH = (osi_queue_t *)TlsGetValue(tls_LockRefH);
lockRefT = (osi_queue_t *)TlsGetValue(tls_LockRefT);
if (lockRefp->type == OSI_LOCK_RW && lockRefp->rw == lockp) {
osi_QRemoveHT(&lockRefH, &lockRefT, &lockRefp->q);
free(lockRefp);
+ found = 1;
break;
}
}
+ osi_assertx(found, "read lock not found in TLS queue");
TlsSetValue(tls_LockRefH, lockRefH);
TlsSetValue(tls_LockRefT, lockRefT);
}
if (lockp->level != 0) {
+ int found = 0;
lockRefH = (osi_queue_t *)TlsGetValue(tls_LockRefH);
lockRefT = (osi_queue_t *)TlsGetValue(tls_LockRefT);
if (lockRefp->type == OSI_LOCK_RW && lockRefp->rw == lockp) {
osi_QRemoveHT(&lockRefH, &lockRefT, &lockRefp->q);
free(lockRefp);
+ found = 1;
break;
}
}
+ osi_assertx(found, "write lock not found in TLS queue");
TlsSetValue(tls_LockRefH, lockRefH);
TlsSetValue(tls_LockRefT, lockRefT);
EnterCriticalSection(csp);
osi_assertx(lockp->flags & OSI_LOCKFLAG_EXCL, "write lock not held");
+ osi_assertx(lockp->tid == thrd_Current(), "write lock not held by current thread");
lockp->tid = 0;
EnterCriticalSection(csp);
osi_assertx(lockp->flags & OSI_LOCKFLAG_EXCL, "write lock not held");
+ osi_assertx(lockp->tid == thrd_Current(), "write lock not held by current thread");
/* convert write lock to read lock */
lockp->flags &= ~OSI_LOCKFLAG_EXCL;
}
if (lockp->level != 0) {
+ int found = 0;
lockRefH = (osi_queue_t *)TlsGetValue(tls_LockRefH);
lockRefT = (osi_queue_t *)TlsGetValue(tls_LockRefT);
if (lockRefp->type == OSI_LOCK_MUTEX && lockRefp->mx == lockp) {
osi_QRemoveHT(&lockRefH, &lockRefT, &lockRefp->q);
free(lockRefp);
+ found = 1;
break;
}
}
+ osi_assertx(found, "mutex lock not found in TLS queue");
TlsSetValue(tls_LockRefH, lockRefH);
TlsSetValue(tls_LockRefT, lockRefT);
}
EnterCriticalSection(csp);
osi_assertx(lockp->flags & OSI_LOCKFLAG_EXCL, "mutex not held");
+ osi_assertx(lockp->tid == thrd_Current(), "mutex not held by current thread");
lockp->flags &= ~OSI_LOCKFLAG_EXCL;
lockp->tid = 0;