Photon Server API Documentation v5.0RC1

Public Member Functions | Properties | List of all members
ExitGames.Concurrency.Fibers.StubFiber Class Reference

StubFiber does not use a backing thread or a thread pool for execution. Actions are added to pending lists for execution. These actions can be executed synchronously by the calling thread. This class is not thread safe and should not be used in production code. More...

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

Public Member Functions

void Start ()
 No Op More...
 
void Dispose ()
 Clears all subscriptions, scheduled, and pending actions. More...
 
void Enqueue (Action action)
 Enqueue a single action. More...
 
IDisposable Schedule (Action action, int firstInMs)
 Adds a scheduled action to the list. More...
 
IDisposable ScheduleOnInterval (Action action, int firstInMs, int regularInMs)
 Adds scheduled action to list. More...
 
IDisposable Schedule (IFiberAction action, int firstInMs)
 Adds a scheduled action to the list. More...
 
IDisposable ScheduleOnInterval (IFiberAction action, int firstInMs, int regularInMs)
 Adds scheduled action to list. More...
 
void ExecuteAllPendingUntilEmpty ()
 Execute all actions in the pending list. If any of the executed actions enqueue more actions, execute those as well. More...
 
void ExecuteAllPending ()
 Execute all actions in the pending list. More...
 
void ExecuteAllScheduled ()
 Execute all actions in the scheduled list. More...
 
- Public Member Functions inherited from ExitGames.Concurrency.Core.ISubscriptionRegistry
void RegisterSubscription (IDisposable toAdd)
 Register subscription to be unsubcribed from when the fiber is disposed. /summary> param name="toAdd"> More...
 
bool DeregisterSubscription (IDisposable toRemove)
 
- Public Member Functions inherited from ExitGames.Concurrency.Core.IExecutionContext
void Enqueue (IFiberAction action)
 Enqueue a single action. More...
 

Properties

int NumSubscriptions [get]
 
List< IDisposable > Subscriptions [get]
 All subscriptions. More...
 
List< IFiberActionPending [get]
 All pending actions. More...
 
List< StubScheduledActionScheduled [get]
 All scheduled actions. More...
 
bool ExecutePendingImmediately [get, set]
 If true events will be executed immediately rather than added to the pending list. More...
 

Detailed Description

StubFiber does not use a backing thread or a thread pool for execution. Actions are added to pending lists for execution. These actions can be executed synchronously by the calling thread. This class is not thread safe and should not be used in production code.

The class is typically used for testing asynchronous code to make it completely synchronous and deterministic.

Member Function Documentation

◆ Dispose()

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

Clears all subscriptions, scheduled, and pending actions.

◆ Enqueue()

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

Enqueue a single action.

Parameters
action

Implements ExitGames.Concurrency.Core.IExecutionContext.

◆ ExecuteAllPending()

void ExitGames.Concurrency.Fibers.StubFiber.ExecuteAllPending ( )
inline

Execute all actions in the pending list.

◆ ExecuteAllPendingUntilEmpty()

void ExitGames.Concurrency.Fibers.StubFiber.ExecuteAllPendingUntilEmpty ( )
inline

Execute all actions in the pending list. If any of the executed actions enqueue more actions, execute those as well.

◆ ExecuteAllScheduled()

void ExitGames.Concurrency.Fibers.StubFiber.ExecuteAllScheduled ( )
inline

Execute all actions in the scheduled list.

◆ Schedule() [1/2]

IDisposable ExitGames.Concurrency.Fibers.StubFiber.Schedule ( Action  action,
int  firstInMs 
)
inline

Adds a scheduled action to the list.

Parameters
action
firstInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

◆ Schedule() [2/2]

IDisposable ExitGames.Concurrency.Fibers.StubFiber.Schedule ( IFiberAction  action,
int  firstInMs 
)
inline

Adds a scheduled action to the list.

Parameters
action
firstInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

◆ ScheduleOnInterval() [1/2]

IDisposable ExitGames.Concurrency.Fibers.StubFiber.ScheduleOnInterval ( Action  action,
int  firstInMs,
int  regularInMs 
)
inline

Adds scheduled action to list.

Parameters
action
firstInMs
regularInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

◆ ScheduleOnInterval() [2/2]

IDisposable ExitGames.Concurrency.Fibers.StubFiber.ScheduleOnInterval ( IFiberAction  action,
int  firstInMs,
int  regularInMs 
)
inline

Adds scheduled action to list.

Parameters
action
firstInMs
regularInMs
Returns

Implements ExitGames.Concurrency.Core.IScheduler.

◆ Start()

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

Property Documentation

◆ ExecutePendingImmediately

bool ExitGames.Concurrency.Fibers.StubFiber.ExecutePendingImmediately
getset

If true events will be executed immediately rather than added to the pending list.

◆ NumSubscriptions

int ExitGames.Concurrency.Fibers.StubFiber.NumSubscriptions
get

◆ Pending

List<IFiberAction> ExitGames.Concurrency.Fibers.StubFiber.Pending
get

All pending actions.

◆ Scheduled

List<StubScheduledAction> ExitGames.Concurrency.Fibers.StubFiber.Scheduled
get

All scheduled actions.

◆ Subscriptions

List<IDisposable> ExitGames.Concurrency.Fibers.StubFiber.Subscriptions
get

All subscriptions.