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

This IDisposable uses the Monitor class. It is used to replaces try-finally blocks with "using" statements. More...

Inheritance diagram for ExitGames.Threading.Lock:

Public Member Functions

void Dispose ()
 Calls Monitor.Exit. More...
 

Static Public Member Functions

static IDisposable Enter (object syncObject)
 Enters a critical section with Monitor.Enter(object) and returns a new instance of Lock. More...
 
static IDisposable TryEnter (object syncObject, int millisecondsTimeout)
 Enters a critical section with Monitor.TryEnter(object,int) and returns a new instance of Lock. More...
 

Detailed Description

This IDisposable uses the Monitor class. It is used to replaces try-finally blocks with "using" statements.

using (Lock.Enter(syncRoot))
{
// critical section here
}

Member Function Documentation

void ExitGames.Threading.Lock.Dispose ( )
inline

Calls Monitor.Exit.

static IDisposable ExitGames.Threading.Lock.Enter ( object  syncObject)
inlinestatic

Enters a critical section with Monitor.Enter(object) and returns a new instance of Lock.

Parameters
syncObjectThe sync object.
Returns
Disposing the result leads to Monitor.Exit.
static IDisposable ExitGames.Threading.Lock.TryEnter ( object  syncObject,
int  millisecondsTimeout 
)
inlinestatic

Enters a critical section with Monitor.TryEnter(object,int) and returns a new instance of Lock.

Parameters
syncObjectThe sync object.
millisecondsTimeoutThe milliseconds Timeout.
Returns
Disposing the result leads to Monitor.Exit.