Minor suggestion for CriticalSection::CriticalSection


#1

Apparently, EnterCriticalSection on Windows 2000 (and previous versions) can fail if the machine runs low on memory. This can be averted by doing this to init the critical section:

InitializeCriticalSectionAndSpinCount((CRITICAL_SECTION*)internal, 0x80000000);

The “0x80000000” tells Windows to pre-allocate space.

So I was thinking that CriticalSection::CriticalSection could be modified accordingly.

This isn’t a big deal; I just wanted to suggest this because tracing down a problem where EnterCriticalSection fails could be very painful.

Matt


#2