CSyncObject::Lock

Call this function to gain access to the resource controlled by the synchronization object.

virtual BOOL Lock( 
   DWORD dwTimeout = INFINITE  
);

Parameters

  • dwTimeout
    Specifies the amount of time in milliseconds to wait for the synchronization object to be available (signaled). If INFINITE, Lock will wait until the object is signaled before returning.

Return Value

Nonzero if the function was successful; otherwise 0.

Remarks

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.

Requirements

Header: afxmt.h

See Also

Reference

CSyncObject Class

Hierarchy Chart