lockp->flags |= OSI_LOCKFLAG_EXCL;
}
+ lockp->tid = thrd_Current();
+
LeaveCriticalSection(csp);
}
/* if we're here, all clear to set the lock */
lockp->readers++;
}
- LeaveCriticalSection(csp);
+
+ LeaveCriticalSection(csp);
}
void lock_ReleaseRead(osi_rwlock_t *lockp)
osi_assertx(lockp->flags & OSI_LOCKFLAG_EXCL, "write lock not held");
+ lockp->tid = 0;
+
lockp->flags &= ~OSI_LOCKFLAG_EXCL;
if (!osi_TEmpty(&lockp->d.turn)) {
osi_TSignalForMLs(&lockp->d.turn, 0, csp);
lockp->flags &= ~OSI_LOCKFLAG_EXCL;
lockp->readers++;
+ lockp->tid = 0;
+
if (!osi_TEmpty(&lockp->d.turn)) {
osi_TSignalForMLs(&lockp->d.turn, /* still have readers */ 1, csp);
}
i = 1;
}
- LeaveCriticalSection(csp);
+ if (i)
+ lockp->tid = thrd_Current();
+
+ LeaveCriticalSection(csp);
return i;
}
i = 1;
}
+ if (i)
+ lockp->tid = thrd_Current();
+
LeaveCriticalSection(csp);
return i;
mp->flags = 0;
mp->atomicIndex = osi_MUTEXHASH(mp);
mp->readers = 0;
+ mp->tid = 0;
osi_TInit(&mp->d.turn);
return;
}
char type; /* for all types; type 0 uses atomic count */
char flags; /* flags for base type */
unsigned short atomicIndex; /* index into hash table for low-level sync */
+ DWORD tid; /* writer's tid */
unsigned short waiters; /* waiters */
unsigned short readers; /* readers */
union {
osi_turnstile_t turn; /* the real turnstile */
unsigned long refCount; /* so we can iterate cleanly */
short states;
+ DWORD tid;
/* track # of lock calls and blocks */
LARGE_INTEGER lockedTime; /* total time held */
osi_turnstile_t turn; /* the real turnstile */
unsigned long refCount; /* so we can iterate cleanly */
short states;
+ DWORD tid;
/* statistics */
LARGE_INTEGER writeLockedTime; /* total time held */