mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[NTOS:CM] Add debug code for analyzing lock issues
This commit is contained in:
parent
53518bbab3
commit
da64119fe6
@ -160,6 +160,9 @@ typedef struct _CM_KEY_HASH_TABLE_ENTRY
|
||||
EX_PUSH_LOCK Lock;
|
||||
PKTHREAD Owner;
|
||||
PCM_KEY_HASH Entry;
|
||||
#if DBG
|
||||
PVOID LockBackTrace[5];
|
||||
#endif
|
||||
} CM_KEY_HASH_TABLE_ENTRY, *PCM_KEY_HASH_TABLE_ENTRY;
|
||||
|
||||
//
|
||||
|
@ -6,6 +6,19 @@
|
||||
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
#if DBG
|
||||
FORCEINLINE
|
||||
VOID
|
||||
CmpCaptureLockBackTraceByIndex(_In_ ULONG Index)
|
||||
{
|
||||
/* Capture the backtrace */
|
||||
RtlCaptureStackBackTrace(1,
|
||||
_countof(CmpCacheTable[Index].LockBackTrace),
|
||||
CmpCacheTable[Index].LockBackTrace,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Returns the hashkey corresponding to a convkey
|
||||
//
|
||||
@ -104,8 +117,12 @@ FORCEINLINE
|
||||
VOID
|
||||
CmpAcquireKcbLockExclusiveByIndex(ULONG Index)
|
||||
{
|
||||
ASSERT(CmpCacheTable[Index].Owner != KeGetCurrentThread());
|
||||
ExAcquirePushLockExclusive(&CmpCacheTable[Index].Lock);
|
||||
CmpCacheTable[Index].Owner = KeGetCurrentThread();
|
||||
#if DBG
|
||||
CmpCaptureLockBackTraceByIndex(Index);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user