Aracılığıyla paylaş


ReaderWriterLockSlimWrapper.TryEnterReadLock Method

Definition

Overloads

TryEnterReadLock(Int32)

Tries to enter the lock in read mode, with an optional integer time-out.

TryEnterReadLock(TimeSpan)

Tries to enter the lock in read mode, with an optional integer time-out.

TryEnterReadLock(Int32)

Tries to enter the lock in read mode, with an optional integer time-out.

public:
 IDisposable ^ TryEnterReadLock(int millisecondsTimeout);
public IDisposable TryEnterReadLock (int millisecondsTimeout);
member this.TryEnterReadLock : int -> IDisposable
Public Function TryEnterReadLock (millisecondsTimeout As Integer) As IDisposable

Parameters

millisecondsTimeout
Int32

The number of milliseconds to wait, or -1 (System.Threading.Timeout.Infinite) to wait indefinitely.

Returns

If the lock was successfully entered, the return value is an object that will exit the lock when disposed. If the lock was not entered, null is returned.

Applies to

TryEnterReadLock(TimeSpan)

Tries to enter the lock in read mode, with an optional integer time-out.

public:
 IDisposable ^ TryEnterReadLock(TimeSpan timeout);
public IDisposable TryEnterReadLock (TimeSpan timeout);
member this.TryEnterReadLock : TimeSpan -> IDisposable
Public Function TryEnterReadLock (timeout As TimeSpan) As IDisposable

Parameters

timeout
TimeSpan

The interval to wait, or -1 milliseconds to wait indefinitely.

Returns

If the lock was successfully entered, the return value is an object that will exit the lock when disposed. If the lock was not entered, null is returned.

Applies to