Beef Corlib
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
System.Threading.Tasks.Task< TResult > Class Template Reference
Inheritance diagram for System.Threading.Tasks.Task< TResult >:
System.IAsyncResult System.Threading.IThreadPoolWorkItem

Classes

class  ContingentProperties
 
class  SetOnInvokeMres
 

Public Member Functions

 Task (delegate TResult(Object) func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
 
new TaskAwaiter< TResult > GetAwaiter ()
 
void Ref ()
 
void Deref ()
 
void Dispose ()
 
Task ContinueWith (delegate void(Task< TResult >) continuationAction)
 
void Notify (bool allowDelete=true)
 
 Task (Action action)
 
 Task (Action action, CancellationToken cancellationToken)
 
 Task (delegate void(Object) action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
 
void Detach ()
 
void Start ()
 
void Start (TaskScheduler scheduler)
 
void Wait ()
 
bool Wait (int millisecondsTimeout, CancellationToken cancellationToken)
 
TaskAwaiter GetAwaiter ()
 

Protected Types

enum  DetachState : int32 { Deatched = 1, Done = 2 }
 

Protected Member Functions

TResult GetResultCore (bool waitCompletionNotification)
 
 Task (Delegate action, Object state, Task parent, CancellationToken cancellationToken, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler)
 
void FinishStageTwo ()
 
void FinishStageThree ()
 
void FinishContinuations ()
 
void ProcessChildCompletion (Task childTask)
 
void Finish (bool bUserDelegateExecuted)
 
bool FireTaskScheduledIfNeeded (TaskScheduler ts)
 
void TaskConstructorCore (Object action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler)
 
bool InternalWait (int millisecondsTimeout, CancellationToken cancellationToken)
 The core wait function, which is only accesible internally. More...
 
bool AtomicStateUpdate (int32 newBits, int32 illegalBits)
 
bool AtomicStateUpdate (int32 newBits, int32 illegalBits, ref int32 oldFlags)
 
void CancellationCleanupLogic ()
 
bool MarkStarted ()
 
void ScheduleAndStart (bool needsProtection)
 
bool ExecuteEntry (bool bPreventDoubleExecution)
 
virtual void InnerInvoke ()
 
void AddNewChild ()
 Internal function that will be called by a new child task to add itself to the children list of the parent (this). More...
 
void AddCompletionAction (ITaskCompletionAction action)
 

Static Protected Member Functions

static TaskCreationOptions OptionsMethod (int32 flags)
 
static Task InternalCurrentIfAttached (TaskCreationOptions creationOptions)
 

Protected Attributes

TResult m_result
 
bool mHasCompleted
 
int32 mRefCount = 1
 
Object m_stateObject
 
TaskScheduler m_taskScheduler
 
readonly Task m_parent
 
volatile int32 m_stateFlags
 
Monitor mMonitor = new Monitor() ~ delete _
 
DetachState mDetachState = default
 
volatile ContingentProperties m_contingentProperties
 

Static Protected Attributes

const int32 TASK_STATE_STARTED = 0x10000
 
const int32 TASK_STATE_DELEGATE_INVOKED = 0x20000
 
const int32 TASK_STATE_DISPOSED = 0x40000
 
const int32 TASK_STATE_EXCEPTIONOBSERVEDBYPARENT = 0x80000
 
const int32 TASK_STATE_CANCELLATIONACKNOWLEDGED = 0x100000
 
const int32 TASK_STATE_FAULTED = 0x200000
 
const int32 TASK_STATE_CANCELED = 0x400000
 
const int32 TASK_STATE_WAITING_ON_CHILDREN = 0x800000
 
const int32 TASK_STATE_RAN_TO_COMPLETION = 0x01000000
 
const int32 TASK_STATE_WAITINGFORACTIVATION = 0x02000000
 
const int32 TASK_STATE_COMPLETION_RESERVED = 0x04000000
 
const int32 TASK_STATE_THREAD_WAS_ABORTED = 0x08000000
 
const int32 TASK_STATE_WAIT_COMPLETION_NOTIFICATION = 0x10000000
 
const int32 TASK_STATE_EXECUTIONCONTEXT_IS_NULL = 0x20000000
 
const int32 TASK_STATE_TASKSCHEDULED_WAS_FIRED = 0x40000000
 

Properties

TResult? Result [get]
 
static Task InternalCurrent [get]
 
bool IsCompleted [get]
 
Object AsyncState [get]
 
bool IsCancellationRequested [get]
 
bool IsRanToCompletion [get]
 
TaskScheduler ExecutingTaskScheduler [get]
 
TaskCreationOptions Options [get]
 
bool IsCanceled [get]
 
TaskCreationOptions CreationOptions [get]
 
bool IsCancellationAcknowledged [get]
 
bool IsDelegateInvoked [get]
 
bool IsWaitNotificationEnabledOrNotRanToCompletion [get]
 
bool IsSelfReplicatingRoot [get]
 
- Properties inherited from System.IAsyncResult
bool IsCompleted [get]
 
WaitEvent AsyncWaitHandle [get]
 
Object AsyncState [get]
 
bool CompletedSynchronously [get]
 

Member Function Documentation

◆ AddNewChild()

void System.Threading.Tasks.Task< TResult >.AddNewChild ( )
inlineprotected

Internal function that will be called by a new child task to add itself to the children list of the parent (this).

Since a child task can only be created from the thread executing the action delegate of this task, reentrancy is neither required nor supported. This should not be called from anywhere other than the task construction/initialization codepaths.

◆ InternalWait()

bool System.Threading.Tasks.Task< TResult >.InternalWait ( int  millisecondsTimeout,
CancellationToken  cancellationToken 
)
inlineprotected

The core wait function, which is only accesible internally.

It's meant to be used in places in TPL code where the current context is known or cached.