C# Class BEPUutilities.SpinLock

Synchronizes using a busy wait. Take care when using this; if the critical section is long or there's any doubt about the use of a busy wait, consider using Monitor locks or other approaches instead. Replaces the .NET SpinLock on PC and provides its functionality on the Xbox360.
ファイルを表示 Open project: Indiefreaks/igf

Public Methods

Method Description
Enter ( ) : void

Enters the critical section. A thread cannot attempt to enter the spinlock if it already owns the spinlock.

Exit ( ) : void

Exits the critical section. This can only be safely called from the same thread of execution after a corresponding Enter.

TryEnter ( ) : bool

Attempts to enters the critical section. A thread cannot attempt to enter the spinlock if it already owns the spinlock.

Private Methods

Method Description
WaitBriefly ( int &attempt ) : void

Method Details

Enter() public method

Enters the critical section. A thread cannot attempt to enter the spinlock if it already owns the spinlock.
public Enter ( ) : void
return void

Exit() public method

Exits the critical section. This can only be safely called from the same thread of execution after a corresponding Enter.
public Exit ( ) : void
return void

TryEnter() public method

Attempts to enters the critical section. A thread cannot attempt to enter the spinlock if it already owns the spinlock.
public TryEnter ( ) : bool
return bool