Click or drag to resize

Abortable class

DotNet 7.0 threading helper class. Behaves like Thread, except the following specials: - Abort() works similarly to previous runtime versions; - Abortable offers an additional property 'AbortableException'; - Abortable implements IDisposable. Usage: replace "new Thread..." with "new Abortable...", Call Dispose on Abortable-instance when it's no longer used. Attention: This class uses Run(Action, CancellationToken), which was released with.Net 7.0. Although this method is new, it has been marked as "deprecated"!
Inheritance hierarchy
SystemObject
  NetEti.ApplicationControlAbortable

Namespace: NetEti.ApplicationControl
Assembly: NetEti.ProcessTools (in NetEti.ProcessTools.dll) Version: 1.0.0+3226eb04384bdec34e8eaa040302e1906383a7b4
Syntax
public class Abortable

The Abortable Type exposes the following members.

Constructors
 NameDescription of the
Public MethodAbortable(ParameterisedThreadStart) Creates a new Abortable-instance for a parameterised thread.
Public MethodAbortable(ThreadStart) Creates a new Abortable-instance for a parameterless thread.
Public MethodAbortable(ParameterisedThreadStart, Int32) Creates a new Abortable-instance for a parameterised thread with a given maximum stack size.
Public MethodAbortable(ThreadStart, Int32) Creates a new Abortable-instance for a parameterless thread with a given maximum stack size.
Back to the top
Properties
 NameDescription of the
Public PropertyAbortableException Contans an optional exception of the executed thread.
Public PropertyApartmentStateObsolete.
Is no longer supported.
Public PropertyCurrentCulture Contains the current culture.
Public PropertyStatic MemberCurrentPrincipal Contains the current principal or null.
Public PropertyStatic MemberCurrentThread Leads to the CurrentThread.
Public PropertyCurrentUICulture Contains the current ui-culture.
Public PropertyExecutionContext Leads to Thread.ExecutionContext.
Public PropertyIsAliveReturns true if the thread has been started and is not dead.
Public PropertyIsBackground Return whether or not this thread is a background thread. Background threads do not affect when the Execution Engine shuts down.
Public PropertyIsThreadPoolThreadReturns true if the thread is a threadpool thread.
Public PropertyManagedThreadId Leads to the extern int thread-id.
Public PropertyName Contains the thread-name or null.
Public PropertyPriorityReturns the priority of the thread.
Public PropertyThreadState Return the thread state as a consistent set of bits. This is more general then IsAlive or IsBackground.
Back to the top
Methods
 NameDescription of the
Public MethodAbortion Throws a System.Threading.ThreadAbortException on the thread on which the call was done to start thread termination. By calling this method the thread is usually terminated. Exceptions: T:System.PlatformNotSupportedException: .NET Core only: This member is not supported. T:System.Security.SecurityException: The caller does not have the required permission. T:System.Threading.ThreadStateException: The thread that was killed is currently suspended.
Public MethodAbort(Object)Obsolete.
Is no longer supported. Throws a System.Threading.ThreadAbortException on the thread on which the call was done to start thread termination. By calling this method the thread is usually terminated. Exceptions: T:System.PlatformNotSupportedException: .NET Core only: This member is not supported. T:System.Security.SecurityException: The caller does not have the required permission. T:System.Threading.ThreadStateException: The thread that was killed is currently suspended.
Public MethodStatic MemberAllocateDataSlot Leads to Thread.AllocateDataSlot().
Public MethodStatic MemberAllocateNamedDataSlot Leads to Thread.AllocateNamedDataSlot(...).
Public MethodStatic MemberBeginCriticalRegion Leads to Thread.BeginCriticalRegion().
Public MethodStatic MemberBeginThreadAffinity Leads to Thread.BeginThreadAffinity().
Public MethodDisableComObjectEagerCleanup Leads to the extern void DisableComObjectEagerCleanup.
Public MethodStatic MemberEndCriticalRegion Leads to Thread.EndCriticalRegion().
Public MethodStatic MemberEndThreadAffinity Leads to Thread.EndThreadAffinity().
Public MethodStatic MemberFreeNamedDataSlot Leads to Thread.FreeNamedDataSlot(...).
Public MethodGetApartmentState Leads to the internal Interop ApartmentState.
Public MethodGetCompressedStackObsolete.
Is no longer supported.
Public MethodStatic MemberGetCurrentProcessorId Returns the current processor-id.
Public MethodStatic MemberGetData Leads to Thread.GetNamedDataSlot(...).
Public MethodStatic MemberGetDomain Leads to Thread.GetDomain().
Public MethodStatic MemberGetDomainID Leads to Thread.GetDomainID().
Public MethodGetHashCode Leads to Thread.GetHashCode().
(Overwrites ObjectGetHashCode)
Public MethodStatic MemberGetNamedDataSlot Leads to Thread.GetNamedDataSlot(...).
Public MethodGetThread Returns the current helper-thread or null.
Public MethodInterrupt Interrupts a thread that is inside a Wait(), Sleep() or Join(). If that thread is not currently blocked in that manner, it will be interrupted when it next begins to block.
Public MethodJoin Leads to Thread.Join().
Public MethodJoin(Int32) Waits for the thread to die or for timeout milliseconds to elapse.
Public MethodJoin(TimeSpan) Leads to Thread.Join(...).
Public MethodStatic MemberMemoryBarrier Leads to Thread.MemoryBarrier.
Public MethodStatic MemberResetAbortObsolete.
Is no longer supported.
Public MethodResumeObsolete.
Is no longer supported.
Public MethodSetApartmentState Leads to Thread.SetApartmentState(...).
Public MethodSetCompressedStackObsolete.
Is no longer supported.
Public MethodStatic MemberSetData Leads to Thread.SetData(...).
Public MethodStatic MemberSleep(Int32) Suspends the current thread for timeout milliseconds. If timeout == 0, forces the thread to give up the remainder of its timeslice. If timeout == Timeout.Infinite, no timeout will occur.
Public MethodStatic MemberSleep(TimeSpan) Leads to Thread.Sleep(...).
Public MethodStatic MemberSpinWait Wait for a length of time proportional to 'iterations'. Each iteration is should only take a few machine instructions. Calling this API is preferable to coding an explicit busy loop because the hardware can be informed that it is busy waiting.
Public MethodStartCauses the operating system to change the state of the current instance to Running.
Public MethodStart(Object)Causes the operating system to change the state of the current instance to Running, and optionally supplies an object containing data to be used by the method the thread executes.
Public MethodSuspendObsolete.
Is no longer supported.
Public MethodTrySetApartmentState Leads to Thread.TrySetApartmentState(...).
Public MethodUnsafeStartCauses the operating system to change the state of the current instance to Running.
Public MethodUnsafeStart(Object)Causes the operating system to change the state of the current instance to Running, and optionally supplies an object containing data to be used by the method the thread executes.
Public MethodStatic MemberVolatileRead(Byte) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Double) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Int16) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Int32) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Int64) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(IntPtr) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Object) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(SByte) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(Single) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(UInt16) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(UInt32) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(UInt64) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileRead(UIntPtr) Leads to Thread.VolatileRead(...).
Public MethodStatic MemberVolatileWrite(Bytebyte) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(DoubleDouble) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(Int16, Int16) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(Int32, Int32) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(Int64, Int64) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(IntPtr, IntPtr) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(Object, Object) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(SByte, SByte) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(Single, Single) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(UInt16, UInt16) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(UInt32, UInt32) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(UInt64, UInt64) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberVolatileWrite(UIntPtr, UIntPtr) Leads to Thread.VolatileWrite(...).
Public MethodStatic MemberYield Leads to YieldInternal.
Back to the top
Remarks
17.03.2023 Erik Nagel: created. 06.08.2023 Erik Nagel: Added missing comments.
See also