|
-
January 4th, 2006, 08:44 AM
#1
::EnterCriticalSection locking.
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
I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|