diff --git a/src/WINNT/client_osi/osibasel.c b/src/WINNT/client_osi/osibasel.c index 4b4dadd5c9..eca25bf066 100644 --- a/src/WINNT/client_osi/osibasel.c +++ b/src/WINNT/client_osi/osibasel.c @@ -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; diff --git a/src/WINNT/client_osi/osibasel.h b/src/WINNT/client_osi/osibasel.h index fc80df4c8a..7467f06e73 100644 --- a/src/WINNT/client_osi/osibasel.h +++ b/src/WINNT/client_osi/osibasel.h @@ -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 {