Udostępnij za pośrednictwem


CSingleLock::IsLocked

Określa, jeśli obiekt jest skojarzony z CSingleLock obiektu jest niezasygnalizowany (niedostępne).

BOOL IsLocked( );

Wartość zwracana

Niezerowa, jeśli obiekt jest zablokowany; 0 inaczej.

Przykład

// m_Mutex is a data member (of type CMutex)
// of an existing class that implements the resource being shared.

// Relate the synchronization object (m_Mutex) with
// our CSingleLock object. 
CSingleLock singleLock(&m_Mutex);

// Attempt to lock the shared resource
singleLock.Lock(100);    // Wait 100 ms...

// Has the resource been successfully locked?
if (singleLock.IsLocked())
{
    // We were able to lock the resource;
    // we may now work with the data associated with the mutex...

    // Now that we are finished, unlock the resource for others.
    singleLock.Unlock();
}

Wymagania

Nagłówek: afxmt.h

Zobacz też

Informacje

Klasa CSingleLock

Diagram hierarchii