Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
12c (12.2.1.4.0)
E90869-02
Acquire a read lock.

Namespace: Tangosol.Util.Collections
Assembly: Coherence (in Coherence.dll) Version: 12.2.1.4014 (12.2.1.4014)

Syntax

C#
public void AcquireReadLock()

Remarks

This method will block until the read lock is acquired.

Multiple threads can hold read locks at the same time, but no thread will be able to acquire a write lock until all read locks are released.

This method should always be used in combination with a ReleaseReadLock()()()() method in the following manner:

CopyC#
dict.AcquireReadLock();
try
{
    // access dictionary
}
finally
{
    dict.ReleaseReadLock();
}
This will ensure that the lock is released properly even if an exception is thrown by the code within the try block.

See Also