Microsoft DirectX 8.1 (C++) |
Returns TRUE if the current thread is the owner of the specified critical section.
Syntax
BOOL WINAPI CritCheckIn(
CCritSec *pcCrit
);
Parameters
pcCrit
Pointer to a CCritSec critical section.
Return Value
In debug builds, returns TRUE if the current thread is the owner of this critical section, or FALSE otherwise. In retail builds, always returns TRUE.
Remarks
This function is especially useful within the ASSERT macro, to test whether a thread owns a given lock.
Example Code
The following code example shows how to use this function:
{
CCritSec MyLock; // Critical section is not locked yet.
ASSERT(CritCheckIn(&MyLock)); // This assert will fire.
// Lock the critical section.
CAutoLock cObjectLock(&MyLock);
ASSERT(CritCheckIn(&MyLock)); // This assert will not fire.
} // Lock goes out of scope here.
See Also