Beef Corlib
Classes | Public Member Functions | List of all members
System.Threading.Monitor Class Reference

Classes

struct  MonitorLockInstance
 

Public Member Functions

MonitorLockInstance Enter ()
 Acquires the monitor lock. More...
 
void Exit ()
 Releases the monitor lock. More...
 
bool TryEnter ()
 Attempt to enter the monitor without waiting. More...
 
bool TryEnter (int millisecondsTimeout)
 Blocks up to a timeout, or if millisecondsTimeout is -1, will wait forever. More...
 
bool TryEnter (TimeSpan timeout)
 

Member Function Documentation

◆ Enter()

MonitorLockInstance System.Threading.Monitor.Enter ( )
inline

Acquires the monitor lock.

Will block if another thread holds the lock.

Multiple calls to Enter can be issued, and an equivalent number of Exits must be issued to allow another thread to enter.

◆ Exit()

void System.Threading.Monitor.Exit ( )
inline

Releases the monitor lock.

Other threads will be able to enter the monitor unless this thread has issued multiple Enters which have not all be Exited.

◆ TryEnter() [1/2]

bool System.Threading.Monitor.TryEnter ( )
inline

Attempt to enter the monitor without waiting.

Returns
true if the monitor was entered

◆ TryEnter() [2/2]

bool System.Threading.Monitor.TryEnter ( int  millisecondsTimeout)
inline

Blocks up to a timeout, or if millisecondsTimeout is -1, will wait forever.

Returns
true if the monitor was entered