CMultiLock::Lock

DWORD Lock( DWORD dwTimeOut = INFINITE, BOOL bWaitForAll = TRUE, DWORD dwWakeMask = 0 );

Return Value

If Lock fails, it returns  – 1. If successful, it returns one of the following values:

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.

bWaitForAll

Specifies whether all objects waited on must become signaled at the same time before returning. If FALSE, Lock will return when any one of the objects waited on is signaled.

dwWakeMask

Specifies other conditions that are allowed to abort the wait. For a full list of the available options for this parameter, see MsgWaitForMultipleObjects in the Win32 Programmer’s Reference.

Remarks

Call this function to gain access to one or more of the resources controlled by the synchronization objects supplied to the CMultiLock constructor. If bWaitForAll is TRUE, Lock will return successfully as soon as all the synchronization objects become signaled simultaneously. If bWaitForAll is FALSE, Lock will return as soon as one or more of the synchronization objects becomes signaled.

If Lock is not able to return immediately, it will wait for no more than the number of milliseconds specified in the dwTimeOut parameter before returning. If dwTimeOut is INFINITE, Lock will not return until access to an object is gained or a condition specified in dwWakeMask was met. Otherwise, if Lock was able to acquire a synchronization object, it will return successfully; if not, it will return failure.

CMultiLock OverviewClass MembersHierarchy Chart