The information in this article applies to:
SUMMARY
The CCriticalSection class contains a member function, Lock, that can be
used by a thread to gain ownership of a Critical Section object. There are
two versions of the Lock function, one taking no arguments and the other
taking a DWORD argument. The documentation for the latter version of Lock
states that the DWORD argument specifies the amount of time, in
milliseconds, to wait for the critical section to become available. MORE INFORMATION
CCriticalSection::Lock makes a call to ::EnterCriticalSection. This is a
blocking call that does an infinite wait. For example, if another thread
currently owns the Critical Section object, ::EnterCriticalSection blocks
the execution of the calling thread indefinitely until the other thread
releases its ownership. The classes, such as CEvent, CMutex, and
CSemaphore, that wrap other synchronization objects, make a call to
::WaitForSingleObject from their Lock functions. ::WaitForSingleObject
accepts an argument that identifies the time-out interval and executes a
true timed wait. A Critical Section object cannot be used with
::WaitForSingleObject. Therefore, it is not possible to do a timed wait
with Critical Section objects. Additional query words: kbVC400bug
Keywords : kbdocfix kbdocerr kbMFC kbThread kbVC kbVC420fix |
Last Reviewed: August 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |