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