Under what circumstances might a Windows Critical Section have a negative Lock Count?

前端 未结 2 592
孤独总比滥情好
孤独总比滥情好 2021-01-05 03:06

Is there any circumstance in which the LockCount field of a RTL_CRITICAL_SECTION structure in Windows can legitimately be negative?

We\'re tracking a VERY elusive cr

2条回答
  •  一整个雨季
    2021-01-05 03:59

    From here, is a part explanation:

    LockCount This is the most important field in a critical section. It is initialized to a value of -1; a value of 0 or greater indicates that the critical section is held or owned. When it's not equal to -1, the OwningThread field (this field is incorrectly defined in WINNT.H—it should be a DWORD instead of a HANDLE) contains the thread ID that owns this critical section. The delta between this field and the value of (RecursionCount -1) indicates how many additional threads are waiting to acquire the critical section.

提交回复
热议问题