Provides a way to abort a thread after a specified timeout.
| C# | Visual Basic | Visual C++ |
public class Watchdog : IDisposable
Public Class Watchdog _ Implements IDisposable
public ref class Watchdog : IDisposable
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| Watchdog(Object, Duration) |
Constructs a new instance.
| |
| Watchdog(Object, Duration, Thread) |
Constructs a new instance.
| |
| CheckAbortSynchronous()()() |
Can be called by the watched thread (and the watched thread only) to force the
watchdog to check the timeout and consequently abort synchronously.
| |
| Dispose()()() |
Releases all resources held by this instance.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()() |
When the instance is finalized, frees all resources of the instance.
(Overrides Object.Finalize()()().) | |
| GetHashCode()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType()()() | Gets the type of the current instance. (Inherited from Object.) | |
| MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ToString()()() | Returns a string that represents the current object. (Inherited from Object.) | |
| WatchedThread |
The Thread that is watched and aborted if the timeout is elapsed.
|
When the timeout is reached, the WatchedThread is
aborted by calling Abort(Object) on the thread.
If you specify a state object in the Watchdog(Object, Duration) constructor,
that object is set to the ExceptionState of
the ThreadAbortException that is raised when the WatchedThread
is aborted due to the timeout being elapsed.
Note that an asynchronous abort of the watched thread is done not before 150% of the specified timeout are reached. Call the CheckAbortSynchronous()()() method from the watched thread to abort the watched thread synchronously when the timeout is reached, but before the asynchronous abort happens.
| Object | |
| Watchdog | |
