C# Class Subtext.Framework.Threading.Semaphore

Implementation of Dijkstra's PV Semaphore based on the Monitor class.
显示文件 Open project: ayende/Subtext

Public Methods

Method Description
AddOne ( ) : void

V the semaphore (add 1 unit to it).

P ( ) : void

P the semaphore (take out 1 unit from it).

Reset ( int count ) : void

Resets the semaphore to the specified count. Should be used cautiously.

Semaphore ( ) : System

Initialize the semaphore as a binary semaphore.

Semaphore ( int count ) : System

Initialize the semaphore as a counting semaphore.

V ( ) : void

V the semaphore (add 1 unit to it).

WaitOne ( ) : void

P the semaphore (take out 1 unit from it).

Method Details

AddOne() public method

V the semaphore (add 1 unit to it).
public AddOne ( ) : void
return void

P() public method

P the semaphore (take out 1 unit from it).
public P ( ) : void
return void

Reset() public method

Resets the semaphore to the specified count. Should be used cautiously.
public Reset ( int count ) : void
count int
return void

Semaphore() public method

Initialize the semaphore as a binary semaphore.
public Semaphore ( ) : System
return System

Semaphore() public method

Initialize the semaphore as a counting semaphore.
Throws if the count argument is less than 1.
public Semaphore ( int count ) : System
count int Initial number of threads that can take out units from this semaphore.
return System

V() public method

V the semaphore (add 1 unit to it).
public V ( ) : void
return void

WaitOne() public method

P the semaphore (take out 1 unit from it).
public WaitOne ( ) : void
return void