次の方法で共有


CSingleLock::IsLocked

更新 : 2007 年 11 月

CSingleLock オブジェクトに関連付けられているオブジェクトが非シグナル状態 (利用できない状態) かどうかを調べます。

BOOL IsLocked( );

戻り値

オブジェクトがロックされている場合は 0 以外を返します。それ以外の場合は 0 を返します。

使用例

// 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();
}

必要条件

ヘッダー : afxmt.h

参照

参照

CSingleLock クラス

階層図

その他の技術情報

CSingleLock のメンバ