Beispiel #1
0
        private void Unlock(BufferState newState)
        {
            Contract.Requires(State == BufferState.Locked);
            Contract.Requires(newState != BufferState.Locked);

            m_lockReason         = BufferLockReason.None;
            m_currentBufferState = newState;
            m_lockedStateGCHandle.Free();
        }
Beispiel #2
0
        private void Lock(BufferLockReason lockReason)
        {
            Contract.Requires(lockReason != BufferLockReason.None);
            Contract.Requires(State == BufferState.Empty || State == BufferState.Write);

            m_lockReason         = lockReason;
            m_currentBufferState = BufferState.Locked;

            Contract.Assume(!m_lockedStateGCHandle.IsAllocated);
            m_lockedStateGCHandle = GCHandle.Alloc(Buffer, GCHandleType.Pinned);
        }