Click or drag to resize
Ranorex

Watchdog Class

Provides a way to abort a thread after a specified timeout.
Inheritance Hierarchy
SystemObject
  Ranorex.CoreWatchdog

Namespace:  Ranorex.Core
Assembly:  Ranorex.Core (in Ranorex.Core.dll) Version: 12.7.4-git.38314c06
Syntax
public class Watchdog : IDisposable

The Watchdog type exposes the following members.

Constructors
  NameDescription
Public methodWatchdog(Object, Duration)
Constructs a new instance.
Public methodWatchdog(Object, Duration, Thread)
Constructs a new instance.
Top
Properties
  NameDescription
Public propertyWatchedThread
The Thread that is watched and aborted if the timeout is elapsed.
Top
Methods
  NameDescription
Public methodCheckAbortSynchronous
Can be called by the watched thread (and the watched thread only) to force the watchdog to check the timeout and consequently abort synchronously.
Public methodDispose
Releases all resources held by this instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
When the instance is finalized, frees all resources of the instance.
(Overrides ObjectFinalize.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
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.

See Also