CSingleLock::Unlock
Eşitleme nesnesi tarafından sahip olunan & amp; CSingleLock.
BOOL Unlock( );
BOOL Unlock(
LONG lCount,
LPLONG lPrevCount = NULL
);
Parametreler
lCount
Serbest bırakmak için erişim numarası.0'dan büyük olmalıdır.Belirtilen nesnenin sayısı Maksimum aşmasına neden olur, count değişmemiş ve işlevini verir yanlış.lPrevCount
Bir değişkene önceki eşitleme nesnesi alım sayısı işaret ediyor.null, önceki sayısı döndürülmez.
Dönüş Değeri
Sıfır olmayan bir değer işlevi başarılı olursa; Aksi halde 0.
Notlar
Bu işlevi çağıran CSingleLock's yıkıcı.
Birden fazla erişim sayısını bir semafor serbest bırakmak gerekiyorsa, ikinci kullan Unlock ve serbest bırakmak için erişimi sayısını belirtin.
Örnek
// 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();
}
Gereksinimler
Başlık: afxmt.h