What data does the Win32 CRITICAL_SECTION contain, and how big is it?
开发者_StackOverflow社区This is undocumented and presumably implementation specific, but I'm curious to know
This is from my installation of Windows Vista SDK:
WinNT.h:
typedef struct _RTL_CRITICAL_SECTION {
PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
//
// The following three fields control entering and exiting the critical
// section for the resource
//
LONG LockCount;
LONG RecursionCount;
HANDLE OwningThread; // from the thread's ClientId->UniqueThread
HANDLE LockSemaphore;
ULONG_PTR SpinCount; // force size on 64-bit systems when packed
} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
WinBase.h:
typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
Why don't you check the headers files?
Check out WINNT.H
and see what you'll find out :)
(assuming that you have Windows C++ files)
Usually the structure contains:
LONG LockCount;
LONG RecursionCount;
HANDLE OwningThread;
HANDLE LockSemaphore;
DWORD SpinCount;
Edit: a command like sizeof(CRITICAL_SECTION)
will reveal the size.
精彩评论