コード例 #1
0
        public IDisposable AcquireBlockLock(
            RequestLock requestedCollectionLock,
            RequestLock requestedBlockLock,
            Block block)
        {
            // Start by getting a read lock on the collection itself.
            IDisposable collectionLock = AcquireLock(requestedCollectionLock);

            // Get a read lock on the block and then return it.
            IDisposable blockLock = block.AcquireLock(collectionLock, requestedBlockLock);

            return(blockLock);
        }
コード例 #2
0
        /// <summary>
        /// Acquires a lock on the collection, of the requested type, and also a lock
        /// on the block referenced by the index.
        /// </summary>
        /// <param name="requestedCollectionLock"></param>
        /// <param name="blockIndex">The index of the block to lock.</param>
        /// <param name="block">The block retrieved by the index.</param>
        /// <param name="requestedBlockLock"></param>
        /// <returns>An opaque lock object that will release the lock on disposal.</returns>
        public IDisposable AcquireBlockLock(
            RequestLock requestedCollectionLock,
            RequestLock requestedBlockLock,
            int blockIndex,
            out Block block)
        {
            // Start by getting a read lock on the collection itself.
            IDisposable collectionLock = AcquireLock(requestedCollectionLock);

            // Grab the block via the index.
            block = this[blockIndex];

            // Get a read lock on the block and then return it.
            IDisposable blockLock = block.AcquireLock(collectionLock, requestedBlockLock);

            return(blockLock);
        }
コード例 #3
0
        public IDisposable AcquireBlockLock(
			RequestLock requestedCollectionLock,
			RequestLock requestedBlockLock,
			Block block)
        {
            // Start by getting a read lock on the collection itself.
            IDisposable collectionLock = AcquireLock(requestedCollectionLock);

            // Get a read lock on the block and then return it.
            IDisposable blockLock = block.AcquireLock(collectionLock, requestedBlockLock);
            return blockLock;
        }
コード例 #4
0
        /// <summary>
        /// Acquires a lock on the collection, of the requested type, and also a lock
        /// on the block referenced by the index.
        /// </summary>
        /// <param name="requestedCollectionLock"></param>
        /// <param name="blockIndex">The index of the block to lock.</param>
        /// <param name="block">The block retrieved by the index.</param>
        /// <param name="requestedBlockLock"></param>
        /// <returns>An opaque lock object that will release the lock on disposal.</returns>
        public IDisposable AcquireBlockLock(
			RequestLock requestedCollectionLock,
			RequestLock requestedBlockLock,
			int blockIndex,
			out Block block)
        {
            // Start by getting a read lock on the collection itself.
            IDisposable collectionLock = AcquireLock(requestedCollectionLock);

            // Grab the block via the index.
            block = this[blockIndex];

            // Get a read lock on the block and then return it.
            IDisposable blockLock = block.AcquireLock(collectionLock, requestedBlockLock);
            return blockLock;
        }