C# Class NetMQ.Core.Utils.PollerBase

This serves as the parent-class for Poller and Proactor. It provides for managing a list of timers (ITimerEvents) - adding, cancelling, and executing them, and a Load property.
Datei anzeigen Open project: somdoron/netmq

Public Methods

Method Description
AddTimer ( long timeout, [ sink, int id ) : void

Add a TimerInfo to the internal list, created from the given sink and id - to expire in the given number of milliseconds. Afterward the expiration method TimerEvent on the sink object will be called with argument set to id.

CancelTimer ( [ sink, int id ) : void

Cancel the timer that was created with the given sink object with the given Id.

The complexity of this operation is O(n). We assume it is rarely used.

Protected Methods

Method Description
AdjustLoad ( int amount ) : void

Add the given amount to the load. This is called by individual poller implementations to manage the load.

This is thread-safe.

ExecuteTimers ( ) : int

Execute any timers that are due. Return the number of milliseconds to wait to match the next timer or 0 meaning "no timers".

PollerBase ( ) : System.Collections.Generic

Create a new PollerBase object - which simply creates an empty m_timers collection.

Method Details

AddTimer() public method

Add a TimerInfo to the internal list, created from the given sink and id - to expire in the given number of milliseconds. Afterward the expiration method TimerEvent on the sink object will be called with argument set to id.
public AddTimer ( long timeout, [ sink, int id ) : void
timeout long the timeout-period in milliseconds of the new timer
sink [ the IProactorEvents to add for the sink of the new timer
id int the Id to assign to the new TimerInfo
return void

AdjustLoad() protected method

Add the given amount to the load. This is called by individual poller implementations to manage the load.
This is thread-safe.
protected AdjustLoad ( int amount ) : void
amount int
return void

CancelTimer() public method

Cancel the timer that was created with the given sink object with the given Id.
The complexity of this operation is O(n). We assume it is rarely used.
public CancelTimer ( [ sink, int id ) : void
sink [ the ITimerEvent that the timer was created with
id int the Id of the timer to cancel
return void

ExecuteTimers() protected method

Execute any timers that are due. Return the number of milliseconds to wait to match the next timer or 0 meaning "no timers".
protected ExecuteTimers ( ) : int
return int

PollerBase() protected method

Create a new PollerBase object - which simply creates an empty m_timers collection.
protected PollerBase ( ) : System.Collections.Generic
return System.Collections.Generic