For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
This class provides methods for obtaining and releasing ownership of a critical section object.
class CComSafeDeleteCriticalSection : public CComCriticalSection
|CComSafeDeleteCriticalSection::Init||Creates and initializes a critical section object.|
|CComSafeDeleteCriticalSection::Lock||Obtains ownership of the critical section object.|
|CComSafeDeleteCriticalSection::Term||Releases system resources used by the critical section object.|
|m_bInitialized||Flags whether the internal CRITICAL_SECTION object has been initialized.|
When an instance of
CComSafeDeleteCriticalSection goes out of scope or is explicitly deleted from memory, the underlying critical section object will automatically be cleaned up if it is still valid. In addition, the CComSafeDeleteCriticalSection::Term method will exit gracefully if the underlying critical section object has not yet been allocated or has already been released from memory.
See CComCriticalSection for more information on critical section helper classes.
Sets the m_bInitialized data member to false.
Releases the internal CRITICAL_SECTION object from memory if the m_bInitialized data member is set to true.
HRESULT Init() throw();
Returns the result of CComCriticalSection::Init.
Calls the base class implementation of Lock.
Returns the result of CComCriticalSection::Lock.
This method assumes the m_bInitialized data member is set to true upon entry. An assertion is generated in Debug builds if this condidtion is not met.
For more information on the behavior of the function, refer to CComCriticalSection::Lock.
Flags whether the internal CRITICAL_SECTION object has been initialized.
The m_bInitialized data member is used to track validity of the underlying CRITICAL_SECTION object associated with the CComSafeDeleteCriticalSection class. The underlying CRITICAL_SECTION object will not be attempted to be released from memory if this flag is not set to true.
Calls the base class implementation of CComCriticalSection::Term if the internal CRITICAL_SECTION object is valid.
HRESULT Term() throw();
It is safe to call this method even if the internal CRITICAL_SECTION object is not valid. The destructor of this class calls this method if the m_bInitialized data member is set to true.