Provides support for managing a large number
of timers represented by TimerItem instances. The timer wheel is
optimized so that add/remove operations for timer items is constant
time (O(1)).
Namespace:
Microsoft.Rtc.Signaling
Assembly: Microsoft.Rtc.Collaboration(in Microsoft.Rtc.Collaboration.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Class TimerWheel _ Implements IDisposable |
C# |
---|
public class TimerWheel : IDisposable |
Visual C++ |
---|
public ref class TimerWheel : IDisposable |
JavaScript |
---|
Microsoft.Rtc.Signaling.TimerWheel = function(); Type.createClass( 'Microsoft.Rtc.Signaling.TimerWheel', null, IDisposable); |
Remarks
The implementation leverage a single system timer to
identity and select expired timer items managed. The timer wheel
maintains a wheel comprising of sectors. Each sector contains timer
items that belong to that sector. The timer wheel manages the
current sector index which is incremented every time the system
timer expires. All the timer items in the sector are examined to
determine those that have expired. The expired timer items are
removed from the sector that the corresponding expiry callback are
invoked in a seperate worker thread. Each timer items maintains the
timespan, the sector index, the index within the sector, and a
count indicating the number of times the sector needs to be hit
before the timer item will expire. The sector span indicates the
timer span value for the system timer. It is possible for an
application to use to two timer wheel to manager both fine and
coarse timer items. For managing fine time items, the sector span
can be very small such as 5 seconds. For coarse timer items, the
sector span can be larger such as 1 minute. The application should
choose the number of sectors and sector span so that the average
number of items that can exist in a sector can be processed within
the sector span time. The processing time includes the time it
takes the examine all the timer items in the sector to determine
the ones that expired but does not include the time it takes to
invoke the expiry callback for the timer items. The processing of a
sector involves rearranging all the items so that the expiry timer
items are at the end of the list and then the list is truncated to
remove the expired items.
Inheritance Hierarchy
Object
Microsoft.Rtc.Signaling . . :: . TimerWheel
Microsoft.Rtc.Signaling . . :: . TimerWheel