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

◆ PoolFiber() [1/3]

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

Construct new instance.

Parameters
pool
executor

◆ PoolFiber() [2/3]

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

Create a pool fiber with the default thread pool.

◆ PoolFiber() [3/3]

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

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

Member Function Documentation

◆ DeregisterSubscription()

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

Deregister a subscription.

Parameters
toRemove
Returns

Implements ExitGames.Concurrency.Core.ISubscriptionRegistry.

◆ Dispose()

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

Stops the fiber.

◆ Enqueue()

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

Enqueue a single action.

Parameters
action

Implements ExitGames.Concurrency.Core.IExecutionContext.

◆ RegisterSubscription()

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.

◆ Schedule()

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

IScheduler.Schedule(Action,long)

Parameters
action
firstInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

◆ ScheduleOnInterval()

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.

◆ Start()

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

Start consuming actions.

Implements ExitGames.Concurrency.Fibers.IFiber.

◆ Stop()

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

Stop consuming actions.

Member Data Documentation

◆ started

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

Property Documentation

◆ CounterDequeue

ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterDequeue
getset

◆ CounterEnqueue

ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterEnqueue
getset

◆ CounterItemsInExecution

ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterItemsInExecution
getset

◆ CounterItemsInQueue

ICounter ExitGames.Concurrency.Fibers.PoolFiber.CounterItemsInQueue
getset

◆ NumSubscriptions

int ExitGames.Concurrency.Fibers.PoolFiber.NumSubscriptions
get

Number of subscriptions.