다음을 통해 공유


CSingleLock::Unlock

소유 하는 동기화 개체를 해제 CSingleLock.

BOOL Unlock( ); 
BOOL Unlock(
   LONG lCount,
   LPLONG lPrevCount = NULL 
);

매개 변수

  • lCount
    액세스 수를 분리 합니다.0보다 커야 합니다.지정한 최대치를 초과 하는 개체 수가 손실 되 면 횟수는 변경 되지 않고 반환 거짓.

  • lPrevCount
    이전 동기화 개체의 수를 받는 변수를 가리킵니다.경우 NULL, 이전 카운트를 반환 되지 않습니다.

반환 값

함수가 성공 하면 0이 아닌. 그렇지 않으면 0입니다.

설명

이 함수를 호출 CSingleLock의 소멸자입니다.

두 개 이상의 액세스 횟수 세마포를 해제 하는 경우 두 번째 폼의 사용 Unlock 및 해제 하는 액세스를 지정 합니다.

예제

// 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
if (singleLock.Lock(100))    // Wait 100 ms...
{
    // 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();
}

요구 사항

헤더: afxmt.h

참고 항목

참조

CSingleLock 클래스

계층 구조 차트