Photon Server API
Public Member Functions | Static Public Member Functions | List of all members
ExitGames.Threading.UpgradeableReadLock Struct Reference

This IDisposable uses the ReaderWriterLockSlim for critical sections that allow one writer and multiple reader. The counter parts are WriteLock and ReadLock. It is used to replaces try-finally blocks with "using" statements. More...

Inheritance diagram for ExitGames.Threading.UpgradeableReadLock:

Public Member Functions

void Dispose ()
 Calls ReaderWriterLockSlim.ExitUpgradeableReadLock. More...
 

Static Public Member Functions

static IDisposable Enter (ReaderWriterLockSlim syncObject)
 Enters a critical section with ReaderWriterLockSlim.EnterUpgradeableReadLock and returns a new instance of UpgradeableReadLock. More...
 
static IDisposable TryEnter (ReaderWriterLockSlim syncObject, int millisecondsTimeout)
 Enters a critical section with ReaderWriterLockSlim.TryEnterUpgradeableReadLock(int) and returns a new instance of WriteLock. More...
 

Detailed Description

This IDisposable uses the ReaderWriterLockSlim for critical sections that allow one writer and multiple reader. The counter parts are WriteLock and ReadLock. It is used to replaces try-finally blocks with "using" statements.

using (UpgradeableReadLock.Enter(rwLock))
{
// critical section here
}

Member Function Documentation

void ExitGames.Threading.UpgradeableReadLock.Dispose ( )
inline

Calls ReaderWriterLockSlim.ExitUpgradeableReadLock.

static IDisposable ExitGames.Threading.UpgradeableReadLock.Enter ( ReaderWriterLockSlim  syncObject)
inlinestatic

Enters a critical section with ReaderWriterLockSlim.EnterUpgradeableReadLock and returns a new instance of UpgradeableReadLock.

Parameters
syncObjectThe reader writer lock.
Returns
A UpgradeableReadLock that can be disposed to call ReaderWriterLockSlim.ExitUpgradeableReadLock.
static IDisposable ExitGames.Threading.UpgradeableReadLock.TryEnter ( ReaderWriterLockSlim  syncObject,
int  millisecondsTimeout 
)
inlinestatic

Enters a critical section with ReaderWriterLockSlim.TryEnterUpgradeableReadLock(int) and returns a new instance of WriteLock.

Parameters
syncObjectThe reader writer lock.
millisecondsTimeoutThe timeout for ReaderWriterLockSlim.TryEnterUpgradeableReadLock(int) in milliseconds.
Returns
A UpgradeableReadLock that can be disposed to call ReaderWriterLockSlim.ExitUpgradeableReadLock.
Exceptions
LockTimeoutExceptionReaderWriterLockSlim.TryEnterUpgradeableReadLock(int) returned false.