Microsoft DirectX 8.1 (C++)

CCritSec Class

The CCritSec class provides a thread lock.

This class is a wrapper for a critical section. You can lock and unlock the thread by calling the CCritSec::Lock and CCritSec::Unlock methods. However, it is safer to use this class in conjunction with the CAutoLock class. When the CAutoLock class goes out of scope, it automatically unlocks the CCritSec object. Moreover, it compiles to efficient inline code.

Requirements

Header: Declared in Wxutil.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Public Member Variables  
m_currentOwner Thread identifier of the owning thread.
m_lockCount Number of outstanding locks on this object.
m_fTrace Boolean value that specifies whether to trace this lock.
Public Methods  
CCritSec Constructor method.
~CCritSec Destructor method.
Lock Locks the critical section object.
Unlock Unlocks the critical section object.