BOOL Lock( DWORD dwTimeOut = INFINITE );
Return Value
Nonzero if the function was successful; otherwise 0.
Parameters
dwTimeOut
Specifies the amount of time to wait for the synchronization object to be available (signaled). If INFINITE, Lock will wait until the object is signaled before returning.
Remarks
Call this function to gain access to the resource controlled by the synchronization object supplied to the CSingleLock constructor. If the synchronization object is signaled, Lock will return successfully and the thread now owns the object. If the synchronization object is nonsignaled (unavailable), Lock will wait for the synchronization object to become signaled up to the number of milliseconds specified in the dwTimeOut parameter. If the synchronization object did not become signaled in the specified amount of time, Lock returns failure.