OpenTAP 9.27
API Reference
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
OpenTap.TapThread Class Reference

Represents a item of work in the ThreadManager. Also allows access to the Parent TapThread (the thread that initially calledTapThread.Start(Action, string)) More...

Public Member Functions

void Abort ()
 Aborts the execution of this current instance of the TapThread.
 
override string ToString ()
 Returns a readable string. More...
 

Static Public Member Functions

static void WithNewContext (Action action, TapThread parent)
 Pretends that the current thread is a different thread while evaluating 'action'. This affects the functionality of ThreadHierarchyLocals and TapThread.Current. This overload also specifies which parent thread should be used.
 
static void WithNewContext (Action action)
 Pretends that the current thread is a different thread while evaluating 'action'. This affects the functionality of ThreadHierarchyLocals and TapThread.Current.
 
static TapThread Start (Action action, string name="")
 Enqueue an action to be executed asynchronously. More...
 
static void Sleep (int millisecondsTimeout)
 Blocks the current thread until the current System.Threading.WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval in milliseconds. More...
 
static void ThrowIfAborted ()
 Throws an OperationCancelledException if the current TapThread has been aborted. This is the same as calling TapThread.Current.AbortToken.ThrowIfCancellationRequested().
 
static void Sleep (TimeSpan timeSpan)
 Blocks the current thread for a specified amount of time. Will throw an OperationCancelledException if the thread is aborted during this time. More...
 

Public Attributes

readonly string Name
 An (optional) name identifying the OpenTAP thread.
 

Properties

static TapThreadCurrent [get]
 The currently running TapThread
 
TapThreadStatus Status [get]
 The execution status of the work
 
CancellationToken AbortToken [get]
 The abort token for this thread. Provides an interface to check the cancellation status of the current thread. Note, the status of this token is inherited from parent threads.
 
TapThread Parent [get]
 The parent TapThread that started this thread. In case it is null, then it is not a managed TapThread.
 

Detailed Description

Represents a item of work in the ThreadManager. Also allows access to the Parent TapThread (the thread that initially calledTapThread.Start(Action, string))

Member Function Documentation

◆ Sleep() [1/2]

static void OpenTap.TapThread.Sleep ( int  millisecondsTimeout)
inlinestatic

Blocks the current thread until the current System.Threading.WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval in milliseconds.

Parameters
millisecondsTimeoutThe number of milliseconds to wait, or 0 by default.

◆ Sleep() [2/2]

static void OpenTap.TapThread.Sleep ( TimeSpan  timeSpan)
inlinestatic

Blocks the current thread for a specified amount of time. Will throw an OperationCancelledException if the thread is aborted during this time.

Parameters
timeSpanA System.TimeSpan that represents the number of milliseconds to wait.

◆ Start()

static TapThread OpenTap.TapThread.Start ( Action  action,
string  name = "" 
)
inlinestatic

Enqueue an action to be executed asynchronously.

Parameters
actionThe action to be executed.
nameThe (optional) name of the OpenTAP thread.

◆ ToString()

override string OpenTap.TapThread.ToString ( )
inline

Returns a readable string.

Returns

OpenTAP 9.27 API built Wed Nov 27 2024 13:14:46