Photon Server API
Public Member Functions | Protected Attributes | Properties | List of all members
ExitGames.Concurrency.Fibers.PoolFiber Class Reference

Fiber that uses a thread pool for execution. More...

Inheritance diagram for ExitGames.Concurrency.Fibers.PoolFiber:
ExitGames.Concurrency.Fibers.IFiber ExitGames.Concurrency.Core.ISubscriptionRegistry ExitGames.Concurrency.Core.IExecutionContext ExitGames.Concurrency.Core.IScheduler ExitGames.Concurrency.Fibers.ExtendedPoolFiber

Public Member Functions

 PoolFiber (IThreadPool pool, IExecutor executor)
 Construct new instance. More...
 
 PoolFiber (IExecutor executor)
 Create a pool fiber with the default thread pool. More...
 
 PoolFiber ()
 Create a pool fiber with the default thread pool and default executor. More...
 
void Enqueue (Action action)
 Enqueue a single action. More...
 
void RegisterSubscription (IDisposable toAdd)
 Register subscription to be unsubcribed from when the fiber is disposed. More...
 
bool DeregisterSubscription (IDisposable toRemove)
 Deregister a subscription. More...
 
IDisposable Schedule (Action action, long firstInMs)
 IScheduler.Schedule(Action,long) More...
 
IDisposable ScheduleOnInterval (Action action, long firstInMs, long regularInMs)
 IScheduler.ScheduleOnInterval(Action,long,long) More...
 
void Start ()
 Start consuming actions. More...
 
void Stop ()
 Stop consuming actions. More...
 
void Dispose ()
 Stops the fiber. More...
 

Protected Attributes

int started = (int)ExecutionState.Created
 

Properties

ICounter CounterItemsInQueue [get, set]
 
ICounter CounterItemsInExecution [get, set]
 
ICounter CounterEnqueue [get, set]
 
ICounter CounterDequeue [get, set]
 
int NumSubscriptions [get]
 Number of subscriptions. More...
 

Detailed Description

Fiber that uses a thread pool for execution.

Constructor & Destructor Documentation

ExitGames.Concurrency.Fibers.PoolFiber.PoolFiber ( IThreadPool  pool,
IExecutor  executor 
)
inline

Construct new instance.

Parameters
pool
executor
ExitGames.Concurrency.Fibers.PoolFiber.PoolFiber ( IExecutor  executor)
inline

Create a pool fiber with the default thread pool.

ExitGames.Concurrency.Fibers.PoolFiber.PoolFiber ( )
inline

Create a pool fiber with the default thread pool and default executor.

Member Function Documentation

bool ExitGames.Concurrency.Fibers.PoolFiber.DeregisterSubscription ( IDisposable  toRemove)
inline

Deregister a subscription.

Parameters
toRemove
Returns

Implements ExitGames.Concurrency.Core.ISubscriptionRegistry.

void ExitGames.Concurrency.Fibers.PoolFiber.Dispose ( )
inline

Stops the fiber.

void ExitGames.Concurrency.Fibers.PoolFiber.Enqueue ( Action  action)
inline

Enqueue a single action.

Parameters
action

Implements ExitGames.Concurrency.Core.IExecutionContext.

void ExitGames.Concurrency.Fibers.PoolFiber.RegisterSubscription ( IDisposable  toAdd)
inline

Register subscription to be unsubcribed from when the fiber is disposed.

Parameters
toAdd

Implements ExitGames.Concurrency.Core.ISubscriptionRegistry.

IDisposable ExitGames.Concurrency.Fibers.PoolFiber.Schedule ( Action  action,
long  firstInMs 
)
inline

IScheduler.Schedule(Action,long)

Parameters
action
firstInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

IDisposable ExitGames.Concurrency.Fibers.PoolFiber.ScheduleOnInterval ( Action  action,
long  firstInMs,
long  regularInMs 
)
inline

IScheduler.ScheduleOnInterval(Action,long,long)

Parameters
action
firstInMs
regularInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

void ExitGames.Concurrency.Fibers.PoolFiber.Start ( )
inline

Start consuming actions.

Implements ExitGames.Concurrency.Fibers.IFiber.

void ExitGames.Concurrency.Fibers.PoolFiber.Stop ( )
inline

Stop consuming actions.

Member Data Documentation

int ExitGames.Concurrency.Fibers.PoolFiber.started = (int)ExecutionState.Created
protected

Property Documentation

ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterDequeue
getset
ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterEnqueue
getset
ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterItemsInExecution
getset
ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterItemsInQueue
getset
int ExitGames.Concurrency.Fibers.PoolFiber.NumSubscriptions
get

Number of subscriptions.