Function TryEnterCriticalSection

TryEnterCriticalSection locks a Win32 critical section if it is free or already owned by the calling thread. The function never blocks.

Unlike Windows, RTKernel-32 will implicitly initializes a critical section by calling InitializeCriticalSection if an uninitialized critical section is supplied as a parameter (that is, a structure with all fields set to zero). Thus, calling InitializeCriticalSection is never required. Merely heap-allocated critical sections should be be memset to zero before use. Auto-initializing critical sections is multithread and multiprocessor safe.