mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
windows-add-tid-to-mutex-20050827
Add to mutex objects the ID of the thread that holds the lock. This will make future debugging much easier.
This commit is contained in:
parent
6620b9452b
commit
c0fea63408
@ -192,6 +192,7 @@ void lock_ObtainMutex(struct osi_mutex *lockp)
|
||||
/* if we're here, all clear to set the lock */
|
||||
lockp->flags |= OSI_LOCKFLAG_EXCL;
|
||||
}
|
||||
lockp->tid = thrd_Current();
|
||||
LeaveCriticalSection(csp);
|
||||
}
|
||||
|
||||
@ -212,6 +213,7 @@ void lock_ReleaseMutex(struct osi_mutex *lockp)
|
||||
osi_assertx(lockp->flags & OSI_LOCKFLAG_EXCL, "mutex not held");
|
||||
|
||||
lockp->flags &= ~OSI_LOCKFLAG_EXCL;
|
||||
lockp->tid = 0;
|
||||
if (!osi_TEmpty(&lockp->d.turn)) {
|
||||
osi_TSignalForMLs(&lockp->d.turn, 0, csp);
|
||||
}
|
||||
@ -411,6 +413,7 @@ void lock_InitializeMutex(osi_mutex_t *mp, char *namep)
|
||||
*/
|
||||
mp->type = 0;
|
||||
mp->flags = 0;
|
||||
mp->tid = 0;
|
||||
mp->atomicIndex = osi_MUTEXHASH(mp);
|
||||
osi_TInit(&mp->d.turn);
|
||||
return;
|
||||
|
@ -31,6 +31,7 @@ typedef struct osi_mutex {
|
||||
char type; /* for all types; type 0 uses atomic count */
|
||||
char flags; /* flags for base type */
|
||||
unsigned short atomicIndex; /* index of lock for low-level sync */
|
||||
thread_t tid; /* tid of thread that owns the lock */
|
||||
unsigned short waiters; /* waiters */
|
||||
unsigned short pad;
|
||||
union {
|
||||
|
Loading…
Reference in New Issue
Block a user