Show / Hide Table of Contents

Class AsyncContext

Summary description for AsyncContext.

Inheritance
Object
AsyncContext
AsyncContext<TArgument>
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public abstract class AsyncContext : Object

Constructors

AsyncContext(Boolean, Boolean)

Protected constructor to be called by implementations.

Declaration
protected AsyncContext(bool breakOnError, bool disableTimeLogging)
Parameters
Type Name Description
Boolean breakOnError
Boolean disableTimeLogging

Properties

BreakOnError

Shall an attached debugger break if there has been errors executing the thread. True is the default value.

Declaration
public bool BreakOnError { get; }
Property Value
Type Description
Boolean

ContextIdentifier

Summary description for AsyncContext.

Declaration
public string ContextIdentifier { get; }
Property Value
Type Description
String

CurrentContext

Get AsyncContext for the currently executing thread. This will be null for operations not performed by the ThreadManager.

Declaration
public static AsyncContext CurrentContext { get; }
Property Value
Type Description
AsyncContext

DisableTimeLogging

Disable logging of times from the inner thread.

Declaration
public bool DisableTimeLogging { get; }
Property Value
Type Description
Boolean

Error

Exception thrown while executing the asynchronous operation

Declaration
public Exception Error { get; }
Property Value
Type Description
Exception

HasError

Has an exception been thrown while executing the asynchronous operation?

Declaration
public bool HasError { get; }
Property Value
Type Description
Boolean

ManagedParentThreadId

Get managed thread id for the thread starting the thread represented by the AsyncContext

Declaration
public int ManagedParentThreadId { get; }
Property Value
Type Description
Int32

ManagedThreadId

If we're running in genuine multithread mode, return the managed thread ID of the worker thread. If we're running in singlethread mode, return a pseudo ID, unique to each AsyncContext even though they all run in the same thread

Declaration
public int ManagedThreadId { get; }
Property Value
Type Description
Int32

TerminationEvent

Use this handle for waiting for completion. The ThreadManager.WaitForOperationsToComplete(Int32, AsyncContext[]) method can be used to wait for one or more specified AsyncContext-described threads to complete, without iterations and Sleep calls.

Declaration
public WaitHandle TerminationEvent { get; }
Property Value
Type Description
WaitHandle

Thread

The thread executing the asynchronous operation.

Declaration
public Thread Thread { get; }
Property Value
Type Description
Thread

ThreadName

Name of the thread.

Declaration
public string ThreadName { get; set; }
Property Value
Type Description
String

Methods

add_OperationFailureEvent(AsyncOperationFailure)

Summary description for AsyncContext.

Declaration
public void add_OperationFailureEvent(AsyncOperationFailure value)
Parameters
Type Name Description
AsyncOperationFailure value

add_OperationStartingEvent(AsyncOperationStarting)

Summary description for AsyncContext.

Declaration
public void add_OperationStartingEvent(AsyncOperationStarting value)
Parameters
Type Name Description
AsyncOperationStarting value

add_OperationTerminatingEvent(AsyncOperationTerminating)

Summary description for AsyncContext.

Declaration
public void add_OperationTerminatingEvent(AsyncOperationTerminating value)
Parameters
Type Name Description
AsyncOperationTerminating value

ExecuteAsyncOperation()

Execute the async operation

Declaration
protected abstract void ExecuteAsyncOperation()

remove_OperationFailureEvent(AsyncOperationFailure)

Summary description for AsyncContext.

Declaration
public void remove_OperationFailureEvent(AsyncOperationFailure value)
Parameters
Type Name Description
AsyncOperationFailure value

remove_OperationStartingEvent(AsyncOperationStarting)

Summary description for AsyncContext.

Declaration
public void remove_OperationStartingEvent(AsyncOperationStarting value)
Parameters
Type Name Description
AsyncOperationStarting value

remove_OperationTerminatingEvent(AsyncOperationTerminating)

Summary description for AsyncContext.

Declaration
public void remove_OperationTerminatingEvent(AsyncOperationTerminating value)
Parameters
Type Name Description
AsyncOperationTerminating value

Start()

Summary description for AsyncContext.

Declaration
public void Start()

Events

OperationFailureEvent

This event is called whenever an asynchronous operation throws an exception.

Declaration
public event AsyncOperationFailure OperationFailureEvent
Event Type
Type Description
AsyncOperationFailure

OperationStartingEvent

This event is called whenever a new asynchronous operation is starting. The thread is running, but the callers' delegate has not yet been called.

Declaration
public event AsyncOperationStarting OperationStartingEvent
Event Type
Type Description
AsyncOperationStarting

OperationTerminatingEvent

This event is called whenever a new asynchronous operation is terminating. The thread is still running, and execution of the callers' delegate has just completed.

Declaration
public event AsyncOperationTerminating OperationTerminatingEvent
Event Type
Type Description
AsyncOperationTerminating

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top