C# Class NetMud.CentralControl.Processor

Central handler for all things async and recursive
ファイルを表示 Open project: SwiftAusterity/NetMud

Public Methods

Method Description
GetAllLiveTaskStatusTokens ( ) : CancellationTokenSource>.Dictionary

Get all the living task cancellation tokens

ShutdownAll ( int shutdownDelay, string shutdownAnnouncement, int shutdownAnnouncementFrequency = -1 ) : void

Cancel ALL the current loops

ShutdownLoop ( string designator, int shutdownDelay, string shutdownAnnouncement, int shutdownAnnouncementFrequency = -1 ) : void

Tries to shutdown an existing loop

StartSingeltonChainedLoop ( string designator, int rampupDelay, int cooldownDelay, int maxDuration, Func workProcess ) : void

Starts a brand new Loop

StartSingeltonLoop ( string designator, int rampupDelay, int cooldownDelay, int maxDuration, Func workProcess, Func successTailProcess = null, Func failedTailProcess = null ) : void

Starts a brand new Loop

StartSubscriptionLoop ( string designator, Func subscriberProcess, int pulseCount, bool fireOnce ) : void

Starts a brand new Loop

Private Methods

Method Description
GetAllCurrentSubscribers ( string designator, int pulseCount, bool fireOnce ) : int>>.IList
GetCancellationToken ( string designator ) : CancellationTokenSource

Gets the token from the cache

GetLoopSubscribers ( string designator ) : int>>.IList

Gets the token from the cache

RemoveCancellationToken ( string designator ) : void

Removes a token from the cache

RemoveSubscriberList ( string designator ) : void

Removes a token from the cache

RunAnnouncements ( int shutdownDelay, string shutdownAnnouncement, int shutdownAnnouncementFrequency ) : void

Runs looped formatted messages until the timer runs out

StartLoop ( Func worker, int startDelay ) : void

Starts an endless loop

StoreCancellationToken ( string designator, CancellationTokenSource token ) : void

Store the cancel token in the cache

SubscribeToLoop ( string designator, Func subscriber, int pulseCount ) : int>>.IList

Store the cancel token in the cache

Method Details

GetAllLiveTaskStatusTokens() public static method

Get all the living task cancellation tokens
public static GetAllLiveTaskStatusTokens ( ) : CancellationTokenSource>.Dictionary
return CancellationTokenSource>.Dictionary

ShutdownAll() public static method

Cancel ALL the current loops
public static ShutdownAll ( int shutdownDelay, string shutdownAnnouncement, int shutdownAnnouncementFrequency = -1 ) : void
shutdownDelay int In # of Seconds - how long to wait before cancelling it
shutdownAnnouncement string What to announce (string.format format) before shutting down, empty string = no announcements
shutdownAnnouncementFrequency int In # of Seconds - how often to announce the shutdown, < = 0 is only one announcement
return void

ShutdownLoop() public static method

Tries to shutdown an existing loop
public static ShutdownLoop ( string designator, int shutdownDelay, string shutdownAnnouncement, int shutdownAnnouncementFrequency = -1 ) : void
designator string what the loop is called
shutdownDelay int In # of Seconds - how long to wait before cancelling it
shutdownAnnouncement string What to announce (string.format format) before shutting down, empty string = no announcements, ex "World shutting down in {0} seconds."
shutdownAnnouncementFrequency int In # of Seconds - how often to announce the shutdown, <= 0 is only one announcement
return void

StartSingeltonChainedLoop() public static method

Starts a brand new Loop
public static StartSingeltonChainedLoop ( string designator, int rampupDelay, int cooldownDelay, int maxDuration, Func workProcess ) : void
designator string what the loop will be called
rampupDelay int In # of Seconds - how long to wait before performing the first operation on start
cooldownDelay int In # of Seconds - how long to wait before either shutting the loop down or recurring it
maxDuration int In # of Seconds - kill this loop after this many seconds
workProcess Func What delegate process to call for the loop
return void

StartSingeltonLoop() public static method

Starts a brand new Loop
public static StartSingeltonLoop ( string designator, int rampupDelay, int cooldownDelay, int maxDuration, Func workProcess, Func successTailProcess = null, Func failedTailProcess = null ) : void
designator string what the loop will be called
rampupDelay int In # of Seconds - how long to wait before performing the first operation on start
cooldownDelay int In # of Seconds - how long to wait before either shutting the loop down or recurring it
maxDuration int In # of Seconds - kill this loop after this many seconds
workProcess Func What delegate process to call for the loop
successTailProcess Func What delegate process to call when this loop terminates in success
failedTailProcess Func What delegate process to call when this loop terminates in failure
return void

StartSubscriptionLoop() public static method

Starts a brand new Loop
public static StartSubscriptionLoop ( string designator, Func subscriberProcess, int pulseCount, bool fireOnce ) : void
designator string what the loop will be called
subscriberProcess Func What delegate process to call for the loop
pulseCount int on what pulse does this fire (out of 18000)
fireOnce bool Does this fire only once or does it fire every X pulses
return void