Thetype exposes the following members.
Returns the CancellationTokenSource that can be used to cancel any outstanding operations before terminating a process.
Optionally indicates that the terminator should not actually terminate the hosting process. This is typically enabled for testing or debugging.
Returns the AsyncManualResetEvent that will be raised when the service is being stopped.
Returns true when the application has been signalled to terminate.
Returns the termination timeout.
Adds a termination handler.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Cleanly terminates the current process.
Serves as the default hash function.(Inherited from Object.)
Gets the Type of the current instance.(Inherited from Object.)
Indicates that the application has gracefully stopped and is ready to be terminated.
Emulates a signal instructing the service to close. This will typically be used for unit testing services.
Returns a string that represents the current object.(Inherited from Object.)
This class listens for a termination signal and then gives the process some time to gracefully save state. The termination timeout defaults to 10 seconds but a custom value may be passed to the constructor.
|The parent process or operating system typically enforces its own maximum timeout, so your process may still be killed before your timeout is reached.|
Applications may also use AddHandler(Action) to add one more more methods that will be called when a termination signal is received. Each handler will be called in parallel on its own thread.
Finally, you map pass one or more IDisposable instances to AddDisposable(IDisposable). Dispose will be called for each of these in parallel on its own thread. This can be a handy way of hooking AsyncPeriodicTask instances and other structures into a .
Applications should call ReadyToExit when they have gracefully stopped any activities and saved state so that the process will be terminated immediately. Otherwise, the process will be terminated when the parent process' timeout is finally exceeded.
Applications can also call Exit(Int32) to proactively signal that the process should terminate gracefully.