I have the following class:

Code:
class CAutoCriticalSection: public CRITICAL_SECTION
{
	public:
		CAutoCriticalSection ()
			: m_nLockCount(0)
		{
			::InitializeCriticalSection(this);
		}

		~CAutoCriticalSection ()
		{
			::DeleteCriticalSection(this);
		}

		void	Lock ()		
		{
			::EnterCriticalSection(this); 
			m_nLockCount++; 
		}
		void	UnLock ()	
                               { 
                                              ::LeaveCriticalSection(this); 
                                               m_nLockCount--; 
                               }


	public :	
		int		m_nLockCount;
};
Sometimes, although quite rarely, EnterCriticalSection(this) locks, i.e waits for an undetermined amount of time, and I was wondering if there is anyway to determine what the best course of action would be to release lock and output a diagnosis message to say that an unsuccessful attempt was made to enter the critical section after, say, 2 seconds.

Regards

John