System.Threading.Tasks
Represents one or more errors that occur during application execution.
is used to consolidate multiple failures into a single, throwable
exception object.
Initializes a new instance of the class.
Initializes a new instance of the class with
a specified error message.
The error message that explains the reason for the exception.
Initializes a new instance of the class with a specified error
message and a reference to the inner exception that is the cause of this exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception.
The argument
is null.
Initializes a new instance of the class with
references to the inner exceptions that are the cause of this exception.
The exceptions that are the cause of the current exception.
The argument
is null.
An element of is
null.
Initializes a new instance of the class with
references to the inner exceptions that are the cause of this exception.
The exceptions that are the cause of the current exception.
The argument
is null.
An element of is
null.
Initializes a new instance of the class with a specified error
message and references to the inner exceptions that are the cause of this exception.
The error message that explains the reason for the exception.
The exceptions that are the cause of the current exception.
The argument
is null.
An element of is
null.
Initializes a new instance of the class with a specified error
message and references to the inner exceptions that are the cause of this exception.
The error message that explains the reason for the exception.
The exceptions that are the cause of the current exception.
The argument
is null.
An element of is
null.
Allocates a new aggregate exception with the specified message and list of inner exceptions.
The error message that explains the reason for the exception.
The exceptions that are the cause of the current exception.
The argument
is null.
An element of is
null.
Returns the that is the root cause of this exception.
Invokes a handler on each contained by this .
The predicate to execute for each exception. The predicate accepts as an
argument the to be processed and returns a Boolean to indicate
whether the exception was handled.
Each invocation of the returns true or false to indicate whether the
was handled. After all invocations, if any exceptions went
unhandled, all unhandled exceptions will be put into a new
which will be thrown. Otherwise, the method simply returns. If any
invocations of the throws an exception, it will halt the processing
of any more exceptions and immediately propagate the thrown exception as-is.
An exception contained by this was not handled.
The argument is
null.
Flattens an instances into a single, new instance.
A new, flattened .
If any inner exceptions are themselves instances of
, this method will recursively flatten all of them. The
inner exceptions returned in the new
will be the union of all of the the inner exceptions from exception tree rooted at the provided
instance.
Creates and returns a string representation of the current .
A string representation of the current exception.
Gets a read-only collection of the instances that caused the
current exception.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to One or more errors occurred..
Looks up a localized string similar to An element of innerExceptions was null..
Looks up a localized string similar to {0}{1}---> (Inner Exception #{2}) {3}{4}{5}.
Looks up a localized string similar to No tokens were supplied..
Looks up a localized string similar to The CancellationTokenSource associated with this CancellationToken has been disposed..
Looks up a localized string similar to The CancellationTokenSource has been disposed..
Looks up a localized string similar to The SyncRoot property may not be used for the synchronization of concurrent collections..
Looks up a localized string similar to The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array..
Looks up a localized string similar to The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array..
Looks up a localized string similar to The capacity argument must be greater than or equal to zero..
Looks up a localized string similar to The concurrencyLevel argument must be positive..
Looks up a localized string similar to The index argument is less than zero..
Looks up a localized string similar to TKey is a reference type and item.Key is null..
Looks up a localized string similar to The key already existed in the dictionary..
Looks up a localized string similar to The source argument contains duplicate keys..
Looks up a localized string similar to The key was of an incorrect type for this dictionary..
Looks up a localized string similar to The value was of an incorrect type for this dictionary..
Looks up a localized string similar to The lazily-initialized type does not have a public, parameterless constructor..
Looks up a localized string similar to ValueFactory returned null..
Looks up a localized string similar to The spinCount argument must be in the range 0 to {0}, inclusive..
Looks up a localized string similar to There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported..
Looks up a localized string similar to The event has been disposed..
Looks up a localized string similar to The operation was canceled..
Looks up a localized string similar to The condition argument is null..
Looks up a localized string similar to The timeout must represent a value between -1 and Int32.MaxValue, inclusive..
Looks up a localized string similar to The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously. Synchronous continuations should not be long running..
Looks up a localized string similar to The specified TaskContinuationOptions excluded all continuation kinds..
Looks up a localized string similar to (Internal)An attempt was made to create a LongRunning SelfReplicating task..
Looks up a localized string similar to The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue..
Looks up a localized string similar to The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer..
Looks up a localized string similar to A task may only be disposed if it is in a completion state (RanToCompletion, Faulted or Canceled)..
Looks up a localized string similar to It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync..
Looks up a localized string similar to It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync..
Looks up a localized string similar to It is invalid to specify TaskCreationOptions.SelfReplicating in calls to FromAsync..
Looks up a localized string similar to FromAsync was called with a TaskManager that had already shut down..
Looks up a localized string similar to The tasks argument contains no tasks..
Looks up a localized string similar to It is invalid to exclude specific continuation kinds for continuations off of multiple tasks..
Looks up a localized string similar to The tasks argument included a null value..
Looks up a localized string similar to RunSynchronously may not be called on a task that was already started..
Looks up a localized string similar to RunSynchronously may not be called on a continuation task..
Looks up a localized string similar to RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method..
Looks up a localized string similar to RunSynchronously may not be called on a task that has already completed..
Looks up a localized string similar to Start may not be called on a task that was already started..
Looks up a localized string similar to Start may not be called on a continuation task..
Looks up a localized string similar to Start may not be called on a task with null action..
Looks up a localized string similar to Start may not be called on a promise-style task..
Looks up a localized string similar to Start may not be called on a task that has completed..
Looks up a localized string similar to The task has been disposed..
Looks up a localized string similar to The tasks array included at least one null element..
Looks up a localized string similar to The awaited task has not yet completed..
Looks up a localized string similar to A task was canceled..
Looks up a localized string similar to The exceptions collection was empty..
Looks up a localized string similar to The exceptions collection included at least one null element..
Looks up a localized string similar to A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread..
Looks up a localized string similar to (Internal)Expected an Exception or an IEnumerable<Exception>.
Looks up a localized string similar to ExecuteTask may not be called for a task which was already executed..
Looks up a localized string similar to ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler..
Looks up a localized string similar to The current SynchronizationContext may not be used as a TaskScheduler..
Looks up a localized string similar to The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked..
Looks up a localized string similar to An exception was thrown by a TaskScheduler..
Looks up a localized string similar to It is invalid to specify TaskCreationOptions.SelfReplicating for a Task<TResult>..
Looks up a localized string similar to {Not yet computed}.
Looks up a localized string similar to A task's Exception may only be set directly if the task was created without a function..
Looks up a localized string similar to An attempt was made to transition a task to a final state when it had already completed..
Represents a thread-safe collection of keys and values.
The type of the keys in the dictionary.
The type of the values in the dictionary.
All public and protected members of are thread-safe and may be used
concurrently from multiple threads.
Initializes a new instance of the
class that is empty, has the default concurrency level, has the default initial capacity, and
uses the default comparer for the key type.
Initializes a new instance of the
class that is empty, has the specified concurrency level and capacity, and uses the default
comparer for the key type.
The estimated number of threads that will update the
concurrently.
The initial number of elements that the
can contain.
is
less than 1.
is less than
0.
Initializes a new instance of the
class that contains elements copied from the specified , has the default concurrency
level, has the default initial capacity, and uses the default comparer for the key type.
The whose elements are copied to
the new
.
is a null reference
(Nothing in Visual Basic).
contains one or more
duplicate keys.
Initializes a new instance of the
class that is empty, has the specified concurrency level and capacity, and uses the specified
.
The
implementation to use when comparing keys.
is a null reference
(Nothing in Visual Basic).
Initializes a new instance of the
class that contains elements copied from the specified , has the default concurrency level, has the default
initial capacity, and uses the specified
.
The whose elements are copied to
the new
.
The
implementation to use when comparing keys.
is a null reference
(Nothing in Visual Basic). -or-
is a null reference (Nothing in Visual Basic).
Initializes a new instance of the
class that contains elements copied from the specified ,
has the specified concurrency level, has the specified initial capacity, and uses the specified
.
The estimated number of threads that will update the
concurrently.
The whose elements are copied to the new
.
The implementation to use
when comparing keys.
is a null reference (Nothing in Visual Basic).
-or-
is a null reference (Nothing in Visual Basic).
is less than 1.
contains one or more duplicate keys.
Initializes a new instance of the
class that is empty, has the specified concurrency level, has the specified initial capacity, and
uses the specified .
The estimated number of threads that will update the
concurrently.
The initial number of elements that the
can contain.
The
implementation to use when comparing keys.
is less than 1. -or-
is less than 0.
is a null reference
(Nothing in Visual Basic).
Attempts to add the specified key and value to the .
The key of the element to add.
The value of the element to add. The value can be a null reference (Nothing
in Visual Basic) for reference types.
true if the key/value pair was added to the
successfully; otherwise, false.
is null reference
(Nothing in Visual Basic).
The
contains too many elements.
Determines whether the contains the specified
key.
The key to locate in the .
true if the contains an element with
the specified key; otherwise, false.
is a null reference
(Nothing in Visual Basic).
Attempts to remove and return the the value with the specified key from the
.
The key of the element to remove and return.
When this method returns, contains the object removed from the
or the default value of
if the operation failed.
true if an object was removed successfully; otherwise, false.
is a null reference
(Nothing in Visual Basic).
Removes the specified key from the dictionary if it exists and returns its associated value.
If matchValue flag is set, the key will be removed only if is associated with a particular
value.
The key to search for and remove if it exists.
The variable into which the removed value, if found, is stored.
Whether removal of the key is conditional on its value.
The conditional value to compare against if is true
Attempts to get the value associated with the specified key from the .
The key of the value to get.
When this method returns, contains the object from
the
with the spedified key or the default value of
, if the operation failed.
true if the key was found in the ;
otherwise, false.
is a null reference
(Nothing in Visual Basic).
Compares the existing value for the specified key with a specified value, and if they’re equal,
updates the key with a third value.
The key whose value is compared with and
possibly replaced.
The value that replaces the value of the element with if the comparison results in equality.
The value that is compared to the value of the element with
.
true if the value with was equal to and replaced with ; otherwise,
false.
is a null
reference.
Removes all keys and values from the .
Copies the elements of the to an array of
type , starting at the
specified array index.
The one-dimensional array of type
that is the destination of the elements copied from the . The array must have zero-based indexing.
The zero-based index in at which copying
begins.
is a null reference
(Nothing in Visual Basic).
is less than
0.
is equal to or greater than
the length of the . -or- The number of elements in the source
is greater than the available space from to the end of the destination
.
Copies the key and value pairs stored in the to a
new array.
A new array containing a snapshot of key and value pairs copied from the .
Copy dictionary contents to an array - shared implementation between ToArray and CopyTo.
Important: the caller must hold all locks in m_locks before calling CopyToPairs.
Copy dictionary contents to an array - shared implementation between ToArray and CopyTo.
Important: the caller must hold all locks in m_locks before calling CopyToEntries.
Copy dictionary contents to an array - shared implementation between ToArray and CopyTo.
Important: the caller must hold all locks in m_locks before calling CopyToObjects.
Returns an enumerator that iterates through the .
An enumerator for the .
The enumerator returned from the dictionary is safe to use concurrently with
reads and writes to the dictionary, however it does not represent a moment-in-time snapshot
of the dictionary. The contents exposed through the enumerator may contain modifications
made to the dictionary after was called.
Shared internal implementation for inserts and updates.
If key exists, we always return false; and if updateIfExists == true we force update with value;
If key doesn't exist, we always add value and return true;
Adds a key/value pair to the
if the key does not already exist.
The key of the element to add.
The function used to generate a value for the key
is a null reference
(Nothing in Visual Basic).
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
The value for the key. This will be either the existing value for the key if the
key is already in the dictionary, or the new value for the key as returned by valueFactory
if the key was not in the dictionary.
Adds a key/value pair to the
if the key does not already exist.
The key of the element to add.
the value to be added, if the key does not already exist
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
The value for the key. This will be either the existing value for the key if the
key is already in the dictionary, or the new value if the key was not in the dictionary.
Adds a key/value pair to the if the key does not already
exist, or updates a key/value pair in the if the key
already exists.
The key to be added or whose value should be updated
The function used to generate a value for an absent key
The function used to generate a new value for an existing key
based on the key's existing value
is a null reference
(Nothing in Visual Basic).
is a null reference
(Nothing in Visual Basic).
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
The new value for the key. This will be either be the result of addValueFactory (if the key was
absent) or the result of updateValueFactory (if the key was present).
Adds a key/value pair to the if the key does not already
exist, or updates a key/value pair in the if the key
already exists.
The key to be added or whose value should be updated
The value to be added for an absent key
The function used to generate a new value for an existing key based on
the key's existing value
is a null reference
(Nothing in Visual Basic).
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
The new value for the key. This will be either be the result of addValueFactory (if the key was
absent) or the result of updateValueFactory (if the key was present).
Adds the specified key and value to the .
The object to use as the key of the element to add.
The object to use as the value of the element to add.
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
An element with the same key already exists in the .
Removes the element with the specified key from the .
The key of the element to remove.
true if the element is successfully remove; otherwise false. This method also returns
false if
was not found in the original .
is a null reference
(Nothing in Visual Basic).
Adds the specified value to the
with the specified key.
The
structure representing the key and value to add to the .
The of is null.
The
contains too many elements.
An element with the same key already exists in the
Determines whether the
contains a specific key and value.
The
structure to locate in the .
true if the is found in the ; otherwise, false.
Removes a key and value from the dictionary.
The
structure representing the key and value to remove from the .
true if the key and value represented by is successfully
found and removed; otherwise, false.
The Key property of is a null reference (Nothing in Visual Basic).
Returns an enumerator that iterates through the .
An enumerator for the .
The enumerator returned from the dictionary is safe to use concurrently with
reads and writes to the dictionary, however it does not represent a moment-in-time snapshot
of the dictionary. The contents exposed through the enumerator may contain modifications
made to the dictionary after was called.
Adds the specified key and value to the dictionary.
The object to use as the key.
The object to use as the value.
is a null reference
(Nothing in Visual Basic).
The dictionary contains too many
elements.
is of a type that is not assignable to the key type of the . -or-
is of a type that is not assignable to ,
the type of values in the .
-or- A value with the same key already exists in the .
Gets whether the contains an
element with the specified key.
The key to locate in the .
true if the contains
an element with the specified key; otherwise, false.
is a null reference
(Nothing in Visual Basic).
Provides an for the
.
An for the .
Removes the element with the specified key from the .
The key of the element to remove.
is a null reference
(Nothing in Visual Basic).
Copies the elements of the to an array, starting
at the specified array index.
The one-dimensional array that is the destination of the elements copied from
the . The array must have zero-based
indexing.
The zero-based index in at which copying
begins.
is a null reference
(Nothing in Visual Basic).
is less than
0.
is equal to or greater than
the length of the . -or- The number of elements in the source
is greater than the available space from to the end of the destination
.
Replaces the internal table with a larger one. To prevent multiple threads from resizing the
table as a result of races, the table of buckets that was deemed too small is passed in as
an argument to GrowTable(). GrowTable() obtains a lock, and then checks whether the bucket
table has been replaced in the meantime or not.
Reference to the bucket table that was deemed too small.
Computes the bucket and lock number for a particular key.
Acquires all locks for this hash table, and increments locksAcquired by the number
of locks that were successfully acquired. The locks are acquired in an increasing
order.
Acquires a contiguous range of locks for this hash table, and increments locksAcquired
by the number of locks that were successfully acquired. The locks are acquired in an
increasing order.
Releases a contiguous range of locks.
Gets a collection containing the keys in the dictionary.
Gets a collection containing the values in the dictionary.
A helper method for asserts.
Get the data array to be serialized
Construct the dictionary from a previously seiralized one
Gets or sets the value associated with the specified key.
The key of the value to get or set.
The value associated with the specified key. If the specified key is not found, a get
operation throws a
, and a set operation creates a new
element with the specified key.
is a null reference
(Nothing in Visual Basic).
The property is retrieved and
does not exist in the collection.
Gets the number of key/value pairs contained in the .
The dictionary contains too many
elements.
The number of key/value paris contained in the .
Count has snapshot semantics and represents the number of items in the
at the moment when Count was accessed.
Gets a value that indicates whether the is empty.
true if the is empty; otherwise,
false.
Gets a collection containing the keys in the .
An containing the keys in the
.
Gets a collection containing the values in the .
An containing the values in
the
.
Gets a value indicating whether the dictionary is read-only.
true if the is
read-only; otherwise, false. For , this property always returns
false.
Gets a value indicating whether the has a fixed size.
true if the has a
fixed size; otherwise, false. For , this property always
returns false.
Gets a value indicating whether the is read-only.
true if the is
read-only; otherwise, false. For , this property always
returns false.
Gets an containing the keys of the .
An containing the keys of the .
Gets an containing the values in the .
An containing the values in the .
Gets or sets the value associated with the specified key.
The key of the value to get or set.
The value associated with the specified key, or a null reference (Nothing in Visual Basic)
if is not in the dictionary or is of a type that is
not assignable to the key type of the .
is a null reference
(Nothing in Visual Basic).
A value is being assigned, and is of a type that is not assignable to the
key type of the . -or- A value is being
assigned, and is of a type that is not assignable to the value type
of the
Gets a value indicating whether access to the is
synchronized with the SyncRoot.
true if access to the is synchronized
(thread safe); otherwise, false. For , this property always
returns false.
Gets an object that can be used to synchronize access to the . This property is not supported.
The SyncRoot property is not supported.
The number of concurrent writes for which to optimize by default.
A node in a singly-linked list representing a particular hash table bucket.
A private class to represent enumeration over the dictionary that implements the
IDictionaryEnumerator interface.
Throws the exception on the ThreadPool.
The exception to propagate.
The target context on which to propagate the exception. Null to use the ThreadPool.
Copies the exception's stack trace so its stack trace isn't overwritten.
The exception to prepare.
Provides a builder for asynchronous methods that return .
This type is intended for compiler use only.
AsyncTaskMethodBuilder is a value type, and thus it is copied by value.
Prior to being copied, one of its Task, SetResult, or SetException members must be accessed,
or else the copies may end up building distinct Task instances.
Represents an asynchronous method builder.
A cached VoidTaskResult task used for builders that complete synchronously.
The generic builder object to which this non-generic instance delegates.
Initializes a new .
The initialized .
Initiates the builder's execution with the associated state machine.
Specifies the type of the state machine.
The state machine instance, passed by reference.
Associates the builder with the state machine it represents.
The heap-allocated state machine object.
The argument was null (Nothing in Visual Basic).
The builder is incorrectly initialized.
Perform any initialization necessary prior to lifting the builder to the heap.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Completes the in the
RanToCompletion state.
The builder is not initialized.
The task has already completed.
Completes the in the
Faulted state with the specified exception.
The to use to fault the task.
The argument is null (Nothing in Visual Basic).
The builder is not initialized.
The task has already completed.
Called by the debugger to request notification when the first wait operation
(await, Wait, Result, etc.) on this builder's task completes.
true to enable notification; false to disable a previously set notification.
Gets the for this builder.
The representing the builder's asynchronous operation.
The builder is not initialized.
Gets an object that may be used to uniquely identify this builder to the debugger.
This property lazily instantiates the ID in a non-thread-safe manner.
It must only be used by the debugger, and only in a single-threaded manner
when no other threads are in the middle of accessing this property or this.Task.
Holds state related to the builder's IAsyncStateMachine.
This is a mutable struct. Be very delicate with it.
A reference to the heap-allocated state machine object associated with this builder.
Initiates the builder's execution with the associated state machine.
Specifies the type of the state machine.
The state machine instance, passed by reference.
The argument is null (Nothing in Visual Basic).
Associates the builder with the state machine it represents.
The heap-allocated state machine object.
The argument was null (Nothing in Visual Basic).
The builder is incorrectly initialized.
Gets the Action to use with an awaiter's OnCompleted or UnsafeOnCompleted method.
On first invocation, the supplied state machine will be boxed.
Specifies the type of the method builder used.
Specifies the type of the state machine used.
The builder.
The state machine.
An Action to provide to the awaiter.
Provides the ability to invoke a state machine's MoveNext method under a supplied ExecutionContext.
The context with which to run MoveNext.
The state machine whose MoveNext method should be invoked.
Initializes the runner.
The context with which to run MoveNext.
Invokes MoveNext under the provided context.
Cached delegate used with ExecutionContext.Run.
Invokes the MoveNext method on the supplied IAsyncStateMachine.
The IAsyncStateMachine machine instance.
Provides a builder for asynchronous methods that return void.
This type is intended for compiler use only.
The synchronization context associated with this operation.
State related to the IAsyncStateMachine.
An object used by the debugger to uniquely identify this builder. Lazily initialized.
Temporary support for disabling crashing if tasks go unobserved.
Registers with UnobservedTaskException to suppress exception crashing.
Non-zero if PreventUnobservedTaskExceptions has already been invoked.
Initializes a new .
The initialized .
Initializes the .
The synchronizationContext associated with this operation. This may be null.
Initiates the builder's execution with the associated state machine.
Specifies the type of the state machine.
The state machine instance, passed by reference.
The argument was null (Nothing in Visual Basic).
Associates the builder with the state machine it represents.
The heap-allocated state machine object.
The argument was null (Nothing in Visual Basic).
The builder is incorrectly initialized.
Perform any initialization necessary prior to lifting the builder to the heap.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Completes the method builder successfully.
Faults the method builder with an exception.
The exception that is the cause of this fault.
The argument is null (Nothing in Visual Basic).
The builder is not initialized.
Notifies the current synchronization context that the operation completed.
Gets an object that may be used to uniquely identify this builder to the debugger.
This property lazily instantiates the ID in a non-thread-safe manner.
It must only be used by the debugger and only in a single-threaded manner.
Provides a builder for asynchronous methods that return .
This type is intended for compiler use only.
AsyncTaskMethodBuilder{TResult} is a value type, and thus it is copied by value.
Prior to being copied, one of its Task, SetResult, or SetException members must be accessed,
or else the copies may end up building distinct Task instances.
A cached task for default(TResult).
State related to the IAsyncStateMachine.
The lazily-initialized task.
Must be named m_task for debugger step-over to work correctly.
The lazily-initialized task completion source.
Temporary support for disabling crashing if tasks go unobserved.
Initializes a new .
The initialized .
Initiates the builder's execution with the associated state machine.
Specifies the type of the state machine.
The state machine instance, passed by reference.
Associates the builder with the state machine it represents.
The heap-allocated state machine object.
The argument was null (Nothing in Visual Basic).
The builder is incorrectly initialized.
Perform any initialization necessary prior to lifting the builder to the heap.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Schedules the specified state machine to be pushed forward when the specified awaiter completes.
Specifies the type of the awaiter.
Specifies the type of the state machine.
The awaiter.
The state machine.
Completes the in the
RanToCompletion state with the specified result.
The result to use to complete the task.
The task has already completed.
Completes the builder by using either the supplied completed task, or by completing
the builder's previously accessed task using default(TResult).
A task already completed with the value default(TResult).
The task has already completed.
Completes the in the
Faulted state with the specified exception.
The to use to fault the task.
The argument is null (Nothing in Visual Basic).
The task has already completed.
Called by the debugger to request notification when the first wait operation
(await, Wait, Result, etc.) on this builder's task completes.
true to enable notification; false to disable a previously set notification.
This should only be invoked from within an asynchronous method,
and only by the debugger.
Gets a task for the specified result. This will either
be a cached or new task, never null.
The result for which we need a task.
The completed task containing the result.
Gets the lazily-initialized TaskCompletionSource.
Gets the for this builder.
The representing the builder's asynchronous operation.
Gets an object that may be used to uniquely identify this builder to the debugger.
This property lazily instantiates the ID in a non-thread-safe manner.
It must only be used by the debugger, and only in a single-threaded manner
when no other threads are in the middle of accessing this property or this.Task.
Provides a base class used to cache tasks of a specific return type.
Specifies the type of results the cached tasks return.
A singleton cache for this result type.
This may be null if there are no cached tasks for this TResult.
Creates a non-disposable task.
The result for the task.
The cacheable task.
Creates a cache.
A task cache for this result type.
Gets a cached task if one exists.
The result for which we want a cached task.
A cached task if one exists; otherwise, null.
Provides a cache for Boolean tasks.
A true task.
A false task.
Gets a cached task for the Boolean result.
true or false
A cached task for the Boolean result.
Provides a cache for zero Int32 tasks.
The minimum value, inclusive, for which we want a cached task.
The maximum value, exclusive, for which we want a cached task.
The cache of Task{Int32}.
Creates an array of cached tasks for the values in the range [INCLUSIVE_MIN,EXCLUSIVE_MAX).
Gets a cached task for the zero Int32 result.
The integer value
A cached task for the Int32 result or null if not cached.
Represents state machines generated for asynchronous methods.
This type is intended for compiler use only.
Moves the state machine to its next state.
Configures the state machine with a heap-allocated replica.
The heap-allocated replica.
Represents an awaiter used to schedule continuations when an await operation completes.
Represents an operation that will schedule continuations when the operation completes.
Schedules the continuation action to be invoked when the instance completes.
The action to invoke when the operation completes.
The argument is null (Nothing in Visual Basic).
Schedules the continuation action to be invoked when the instance completes.
The action to invoke when the operation completes.
The argument is null (Nothing in Visual Basic).
Unlike OnCompleted, UnsafeOnCompleted need not propagate ExecutionContext information.
Used with Task(of void)
An interface similar to the one added in .NET 4.0.
The exception that is thrown in a thread upon cancellation of an operation that the thread was executing.
Initializes the exception.
Initializes the exception.
The error message that explains the reason for the exception.
Initializes the exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception.
Initializes the exception.
A cancellation token associated with the operation that was canceled.
Initializes the exception.
The error message that explains the reason for the exception.
A cancellation token associated with the operation that was canceled.
Initializes the exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception.
A cancellation token associated with the operation that was canceled.
Gets a token associated with the operation that was canceled.
A dummy replacement for the .NET internal class StackCrawlMark.
Propogates notification that operations should be canceled.
A may be created directly in an unchangeable canceled or non-canceled state
using the CancellationToken's constructors. However, to have a CancellationToken that can change
from a non-canceled to a canceled state,
CancellationTokenSource must be used.
CancellationTokenSource exposes the associated CancellationToken that may be canceled by the source through its
Token property.
Once canceled, a token may not transition to a non-canceled state, and a token whose
is false will never change to one that can be canceled.
All members of this struct are thread-safe and may be used concurrently from multiple threads.
Internal constructor only a CancellationTokenSource should create a CancellationToken
Initializes the CancellationToken.
The canceled state for the token.
Tokens created with this constructor will remain in the canceled state specified
by the parameter. If is false,
both and will be false.
If is true,
both and will be true.
Registers a delegate that will be called when this CancellationToken is canceled.
If this token is already in the canceled state, the
delegate will be run immediately and synchronously. Any exception the delegate generates will be
propogated out of this method call.
The delegate to be executed when the CancellationToken is canceled.
The instance that can
be used to deregister the callback.
is null.
The associated CancellationTokenSource has been disposed.
Registers a delegate that will be called when this
CancellationToken is canceled.
If this token is already in the canceled state, the
delegate will be run immediately and synchronously. Any exception the delegate generates will be
propogated out of this method call.
The delegate to be executed when the CancellationToken is canceled.
A Boolean value that indicates whether to capture
the current SynchronizationContext and use it
when invoking the .
The instance that can
be used to deregister the callback.
is null.
The associated CancellationTokenSource has been disposed.
Registers a delegate that will be called when this
CancellationToken is canceled.
If this token is already in the canceled state, the
delegate will be run immediately and synchronously. Any exception the delegate generates will be
propogated out of this method call.
The delegate to be executed when the CancellationToken is canceled.
The state to pass to the when the delegate is invoked. This may be null.
The instance that can
be used to deregister the callback.
is null.
The associated CancellationTokenSource has been disposed.
Registers a delegate that will be called when this
CancellationToken is canceled.
If this token is already in the canceled state, the
delegate will be run immediately and synchronously. Any exception the delegate generates will be
propogated out of this method call.
The delegate to be executed when the CancellationToken is canceled.
The state to pass to the when the delegate is invoked. This may be null.
A Boolean value that indicates whether to capture
the current SynchronizationContext and use it
when invoking the .
The instance that can
be used to deregister the callback.
is null.
The associated CancellationTokenSource has been disposed.
Determines whether the current CancellationToken instance is equal to the
specified token.
The other CancellationToken to which to compare this
instance.
True if the instances are equal; otherwise, false. Two tokens are equal if they are associated
with the same CancellationTokenSource or if they were both constructed
from public CancellationToken constructors and their values are equal.
Determines whether the current CancellationToken instance is equal to the
specified .
The other object to which to compare this instance.
True if is a CancellationToken
and if the two instances are equal; otherwise, false. Two tokens are equal if they are associated
with the same CancellationTokenSource or if they were both constructed
from public CancellationToken constructors and their values are equal.
An associated CancellationTokenSource has been disposed.
Serves as a hash function for a CancellationToken.
A hash code for the current CancellationToken instance.
Determines whether two CancellationToken instances are equal.
The first instance.
The second instance.
True if the instances are equal; otherwise, false.
An associated CancellationTokenSource has been disposed.
Determines whether two CancellationToken instances are not equal.
The first instance.
The second instance.
True if the instances are not equal; otherwise, false.
An associated CancellationTokenSource has been disposed.
Throws a OperationCanceledException if
this token has had cancellation requested.
This method provides functionality equivalent to:
if (token.IsCancellationRequested)
throw new OperationCanceledException(token);
The token has had cancellation requested.
The associated CancellationTokenSource has been disposed.
Returns an empty CancellationToken value.
The value returned by this property will be non-cancelable by default.
Gets whether cancellation has been requested for this token.
Whether cancellation has been requested for this token.
This property indicates whether cancellation has been requested for this token,
either through the token initially being construted in a canceled state, or through
calling Cancel
on the token's associated .
If this property is true, it only guarantees that cancellation has been requested.
It does not guarantee that every registered handler
has finished executing, nor that cancellation requests have finished propagating
to all registered handlers. Additional synchronization may be required,
particularly in situations where related objects are being canceled concurrently.
Gets whether this token is capable of being in the canceled state.
If CanBeCanceled returns false, it is guaranteed that the token will never transition
into a canceled state, meaning that will never
return true.
Gets a that is signaled when the token is canceled.
Accessing this property causes a WaitHandle
to be instantiated. It is preferable to only use this property when necessary, and to then
dispose the associated instance at the earliest opportunity (disposing
the source will dispose of this allocated handle). The handle should not be closed or disposed directly.
The associated CancellationTokenSource has been disposed.
Represents a callback delegate that has been registered with a CancellationToken.
To unregister a callback, dispose the corresponding Registration instance.
Attempts to deregister the item. If it's already being run, this may fail.
Entails a full memory fence.
True if the callback was found and deregistered, false otherwise.
Disposes of the registration and unregisters the target callback from the associated
CancellationToken.
If the target callback is currently executing this method will wait until it completes, except
in the degenerate cases where a callback method deregisters itself.
Determines whether two CancellationTokenRegistration
instances are equal.
The first instance.
The second instance.
True if the instances are equal; otherwise, false.
Determines whether two CancellationTokenRegistration instances are not equal.
The first instance.
The second instance.
True if the instances are not equal; otherwise, false.
Determines whether the current CancellationTokenRegistration instance is equal to the
specified .
The other object to which to compare this instance.
True, if both this and are equal. False, otherwise.
Two CancellationTokenRegistration instances are equal if
they both refer to the output of a single call to the same Register method of a
CancellationToken.
Determines whether the current CancellationToken instance is equal to the
specified .
The other CancellationTokenRegistration to which to compare this instance.
True, if both this and are equal. False, otherwise.
Two CancellationTokenRegistration instances are equal if
they both refer to the output of a single call to the same Register method of a
CancellationToken.
Serves as a hash function for a CancellationTokenRegistration..
A hash code for the current CancellationTokenRegistration instance.
Signals to a that it should be canceled.
is used to instantiate a
(via the source's Token property)
that can be handed to operations that wish to be notified of cancellation or that can be used to
register asynchronous operations for cancellation. That token may have cancellation requested by
calling to the source's Cancel
method.
All members of this class, except Dispose, are thread-safe and may be used
concurrently from multiple threads.
The ID of the thread currently executing the main body of CTS.Cancel()
this helps us to know if a call to ctr.Dispose() is running 'within' a cancellation callback.
This is updated as we move between the main thread calling cts.Cancel() and any syncContexts that are used to
actually run the callbacks.
Initializes the .
Communicates a request for cancellation.
The associated will be
notified of the cancellation and will transition to a state where
IsCancellationRequested returns true.
Any callbacks or cancelable operations
registered with the will be executed.
Cancelable operations and callbacks registered with the token should not throw exceptions.
However, this overload of Cancel will aggregate any exceptions thrown into a ,
such that one callback throwing an exception will not prevent other registered callbacks from being executed.
The that was captured when each callback was registered
will be reestablished when the callback is invoked.
An aggregate exception containing all the exceptions thrown
by the registered callbacks on the associated .
This has been disposed.
Communicates a request for cancellation.
The associated will be
notified of the cancellation and will transition to a state where
IsCancellationRequested returns true.
Any callbacks or cancelable operations
registered with the will be executed.
Cancelable operations and callbacks registered with the token should not throw exceptions.
If is true, an exception will immediately propagate out of the
call to Cancel, preventing the remaining callbacks and cancelable operations from being processed.
If is false, this overload will aggregate any
exceptions thrown into a ,
such that one callback throwing an exception will not prevent other registered callbacks from being executed.
The that was captured when each callback was registered
will be reestablished when the callback is invoked.
Specifies whether exceptions should immediately propagate.
An aggregate exception containing all the exceptions thrown
by the registered callbacks on the associated .
This has been disposed.
Releases the resources used by this .
This method is not thread-safe for any other concurrent calls.
Throws an exception if the source has been disposed.
InternalGetStaticSource()
Whether the source should be set.
A static source to be shared among multiple tokens.
Registers a callback object. If cancellation has already occurred, the
callback will have been run by the time this method returns.
Invoke the Canceled event.
The handlers are invoked synchronously in LIFO order.
Creates a CancellationTokenSource that will be in the canceled state
when any of the source tokens are in the canceled state.
The first CancellationToken to observe.
The second CancellationToken to observe.
A CancellationTokenSource that is linked
to the source tokens.
A CancellationTokenSource associated with
one of the source tokens has been disposed.
Creates a CancellationTokenSource that will be in the canceled state
when any of the source tokens are in the canceled state.
The CancellationToken instances to observe.
A CancellationTokenSource that is linked
to the source tokens.
is null.
A CancellationTokenSource associated with
one of the source tokens has been disposed.
Gets whether cancellation has been requested for this CancellationTokenSource.
Whether cancellation has been requested for this CancellationTokenSource.
This property indicates whether cancellation has been requested for this token source, such as
due to a call to its
Cancel method.
If this property returns true, it only guarantees that cancellation has been requested. It does not
guarantee that every handler registered with the corresponding token has finished executing, nor
that cancellation requests have finished propagating to all registered handlers. Additional
synchronization may be required, particularly in situations where related objects are being
canceled concurrently.
A simple helper to determine whether cancellation has finished.
A simple helper to determine whether disposal has occured.
The ID of the thread that is running callbacks.
Gets the CancellationToken
associated with this .
The CancellationToken
associated with this .
The token source has been
disposed.
The currently executing callback
A helper class for collating the various bits of information required to execute
cancellation callbacks.
InternalExecuteCallbackSynchronously_GeneralPath
This will be called on the target synchronization context, however, we still need to restore the required execution context
A sparsely populated array. Elements can be sparse and some null, but this allows for
lock-free additions and growth, and also for constant time removal (by nulling out).
The kind of elements contained within.
Allocates a new array with the given initial size.
How many array slots to pre-allocate.
Adds an element in the first available slot, beginning the search from the tail-to-head.
If no slots are available, the array is grown. The method doesn't return until successful.
The element to add.
Information about where the add happened, to enable O(1) deregistration.
The tail of the doubly linked list.
A struct to hold a link to the exact spot in an array an element was inserted, enabling
constant time removal later on.
A fragment of a sparsely populated array, doubly linked.
The kind of elements contained within.
Provides lazy initialization routines.
These routines avoid needing to allocate a dedicated, lazy-initialization instance, instead using
references to ensure targets have been initialized as they are accessed.
Initializes a target reference type with the type's default constructor if the target has not
already been initialized.
The refence type of the reference to be initialized.
A reference of type to initialize if it has not
already been initialized.
The initialized reference of type .
Type does not have a default
constructor.
Permissions to access the constructor of type were missing.
This method may only be used on reference types. To ensure initialization of value
types, see other overloads of EnsureInitialized.
This method may be used concurrently by multiple threads to initialize .
In the event that multiple threads access this method concurrently, multiple instances of
may be created, but only one will be stored into . In such an occurrence, this method will not dispose of the
objects that were not stored. If such objects must be disposed, it is up to the caller to determine
if an object was not used and to then dispose of the object appropriately.
Initializes a target reference type using the specified function if it has not already been
initialized.
The reference type of the reference to be initialized.
The reference of type to initialize if it has not
already been initialized.
The invoked to initialize the
reference.
The initialized reference of type .
Type does not have a
default constructor.
returned
null.
This method may only be used on reference types, and may
not return a null reference (Nothing in Visual Basic). To ensure initialization of value types or
to allow null reference types, see other overloads of EnsureInitialized.
This method may be used concurrently by multiple threads to initialize .
In the event that multiple threads access this method concurrently, multiple instances of
may be created, but only one will be stored into . In such an occurrence, this method will not dispose of the
objects that were not stored. If such objects must be disposed, it is up to the caller to determine
if an object was not used and to then dispose of the object appropriately.
Initialize the target using the given delegate (slow path).
The reference type of the reference to be initialized.
The variable that need to be initialized
The delegate that will be executed to initialize the target
The initialized variable
Initializes a target reference or value type with its default constructor if it has not already
been initialized.
The type of the reference to be initialized.
A reference or value of type to initialize if it
has not already been initialized.
A reference to a boolean that determines whether the target has already
been initialized.
A reference to an object used as the mutually exclusive lock for initializing
.
The initialized value of type .
Initializes a target reference or value type with a specified function if it has not already been
initialized.
The type of the reference to be initialized.
A reference or value of type to initialize if it
has not already been initialized.
A reference to a boolean that determines whether the target has already
been initialized.
A reference to an object used as the mutually exclusive lock for initializing
.
The invoked to initialize the
reference or value.
The initialized value of type .
Ensure the target is initialized and return the value (slow path). This overload permits nulls
and also works for value type targets. Uses the supplied function to create the value.
The type of target.
A reference to the target to be initialized.
A reference to a location tracking whether the target has been initialized.
A reference to a location containing a mutual exclusive lock.
The to invoke in order to produce the lazily-initialized value.
The initialized object.
Provides a slimmed down version of .
All public and protected members of are thread-safe and may be used
concurrently from multiple threads, with the exception of Dispose, which
must only be used when all other operations on the have
completed, and Reset, which should only be used when no other threads are
accessing the event.
Initializes a new instance of the
class with an initial state of nonsignaled.
Initializes a new instance of the
class with a Boolen value indicating whether to set the intial state to signaled.
true to set the initial state signaled; false to set the initial state
to nonsignaled.
Initializes a new instance of the
class with a Boolen value indicating whether to set the intial state to signaled and a specified
spin count.
true to set the initial state to signaled; false to set the initial state
to nonsignaled.
The number of spin waits that will occur before falling back to a true
wait.
is less than
0 or greater than the maximum allowed value.
Initializes the internal state of the event.
Whether the event is set initially or not.
The spin count that decides when the event will block.
Helper to ensure the lock object is created before first use.
This method lazily initializes the event object. It uses CAS to guarantee that
many threads racing to call this at once don't result in more than one event
being stored and used. The event will be signaled or unsignaled depending on
the state of the thin-event itself, with synchronization taken into account.
True if a new event was created and stored, false otherwise.
Sets the state of the event to signaled, which allows one or more threads waiting on the event to
proceed.
Private helper to actually perform the Set.
Indicates whether we are calling Set() during cancellation.
The object has been canceled.
Sets the state of the event to nonsignaled, which causes threads to block.
Unlike most of the members of , is not
thread-safe and may not be used concurrently with other members of this instance.
Blocks the current thread until the current is set.
The maximum number of waiters has been exceeded.
The caller of this method blocks indefinitely until the current instance is set. The caller will
return immediately if the event is currently in a set state.
Blocks the current thread until the current receives a signal,
while observing a .
The to
observe.
The maximum number of waiters has been exceeded.
was
canceled.
The caller of this method blocks indefinitely until the current instance is set. The caller will
return immediately if the event is currently in a set state.
Blocks the current thread until the current is set, using a
to measure the time interval.
A that represents the number of milliseconds
to wait, or a that represents -1 milliseconds to wait indefinitely.
true if the was set; otherwise,
false.
is a negative
number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
than .
The maximum number of waiters has been exceeded.
Blocks the current thread until the current is set, using a
to measure the time interval, while observing a .
A that represents the number of milliseconds
to wait, or a that represents -1 milliseconds to wait indefinitely.
The to
observe.
true if the was set; otherwise,
false.
is a negative
number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
than .
was canceled.
The maximum number of waiters has been exceeded.
Blocks the current thread until the current is set, using a
32-bit signed integer to measure the time interval.
The number of milliseconds to wait, or (-1) to wait indefinitely.
true if the was set; otherwise,
false.
is a
negative number other than -1, which represents an infinite time-out.
The maximum number of waiters has been exceeded.
Blocks the current thread until the current is set, using a
32-bit signed integer to measure the time interval, while observing a .
The number of milliseconds to wait, or (-1) to wait indefinitely.
The to
observe.
true if the was set; otherwise,
false.
is a
negative number other than -1, which represents an infinite time-out.
The maximum number of waiters has been exceeded.
was canceled.
Releases all resources used by the current instance of .
Unlike most of the members of , is not
thread-safe and may not be used concurrently with other members of this instance.
When overridden in a derived class, releases the unmanaged resources used by the
, and optionally releases the managed resources.
true to release both managed and unmanaged resources;
false to release only unmanaged resources.
Unlike most of the members of , is not
thread-safe and may not be used concurrently with other members of this instance.
Throw ObjectDisposedException if the MRES is disposed
Private helper method to wake up waiters when a cancellationToken gets canceled.
Private helper method for updating parts of a bit-string state value.
Mainly called from the IsSet and Waiters properties setters
Note: the parameter types must be int as CompareExchange cannot take a Uint
The new value
The mask used to set the bits
Private helper method - performs Mask and shift, particular helpful to extract a field from a packed word.
eg ExtractStatePortionAndShiftRight(0x12345678, 0xFF000000, 24) => 0x12, ie extracting the top 8-bits as a simple integer
?? is there a common place to put this rather than being private to MRES?
Performs a Mask operation, but does not perform the shift.
This is acceptable for boolean values for which the shift is unnecessary
eg (val & Mask) != 0 is an appropriate way to extract a boolean rather than using
((val & Mask) >> shiftAmount) == 1
?? is there a common place to put this rather than being private to MRES?
Helper function to measure and update the wait time
The first time (in Ticks) observed when the wait started.
The orginal wait timeoutout in milliseconds.
The new wait time in milliseconds, -1 if the time expired, -2 if overflow in counters
has occurred.
Gets the underlying object for this .
The underlying event object fore this .
Accessing this property forces initialization of an underlying event object if one hasn't
already been created. To simply wait on this ,
the public Wait methods should be preferred.
Gets whether the event is set.
true if the event has is set; otherwise, false.
Gets the number of spin waits that will be occur before falling back to a true wait.
How many threads are waiting.
Provides support for spin-based waiting.
encapsulates common spinning logic. On single-processor machines, yields are
always used instead of busy waits, and on computers with Intel™ processors employing Hyper-Threading™
technology, it helps to prevent hardware thread starvation. SpinWait encapsulates a good mixture of
spinning and true yielding.
is a value type, which means that low-level code can utilize SpinWait without
fear of unnecessary allocation overheads. SpinWait is not generally useful for ordinary applications.
In most cases, you should use the synchronization classes provided by the .NET Framework, such as
. For most purposes where spin waiting is required, however,
the type should be preferred over the System.Threading.Thread.SpinWait method.
While SpinWait is designed to be used in concurrent applications, it is not designed to be
used from multiple threads concurrently. SpinWait's members are not thread-safe. If multiple
threads must spin, each should use its own instance of SpinWait.
Performs a single spin.
This is typically called in a loop, and may change in behavior based on the number of times a
has been called thus far on this instance.
Resets the spin counter.
This makes and behave as though no calls
to had been issued on this instance. If a instance
is reused many times, it may be useful to reset it to avoid yielding too soon.
Spins until the specified condition is satisfied.
A delegate to be executed over and over until it returns true.
The argument is null.
Spins until the specified condition is satisfied or until the specified timeout is expired.
A delegate to be executed over and over until it returns true.
A that represents the number of milliseconds to wait,
or a TimeSpan that represents -1 milliseconds to wait indefinitely.
True if the condition is satisfied within the timeout; otherwise, false
The argument is null.
is a negative number
other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
.
Spins until the specified condition is satisfied or until the specified timeout is expired.
A delegate to be executed over and over until it returns true.
The number of milliseconds to wait, or (-1) to wait indefinitely.
True if the condition is satisfied within the timeout; otherwise, false
The argument is null.
is a
negative number other than -1, which represents an infinite time-out.
Gets the number of times has been called on this instance.
Gets whether the next call to will yield the processor, triggering a
forced context switch.
Whether the next call to will yield the processor, triggering a
forced context switch.
On a single-CPU machine, always yields the processor. On machines with
multiple CPUs, may yield after an unspecified number of calls.
A helper class to get the number of preocessors, it updates the numbers of processors every sampling interval
Gets the number of available processors
Gets whether the current machine has only a single processor.
Represents an asynchronous operation that produces a result at some time in the future.
The type of the result produced by this .
instances may be created in a variety of ways. The most common approach is by
using the task's property to retrieve a instance that can be used to create tasks for several
purposes. For example, to create a that runs a function, the factory's StartNew
method may be used:
// C#
var t = Task<int>.Factory.StartNew(() => GenerateResult());
- or -
var t = Task.Factory.StartNew(() => GenerateResult());
' Visual Basic
Dim t = Task<int>.Factory.StartNew(Function() GenerateResult())
- or -
Dim t = Task.Factory.StartNew(Function() GenerateResult())
The class also provides constructors that initialize the task but that do not
schedule it for execution. For performance reasons, the StartNew method should be the
preferred mechanism for creating and scheduling computational tasks, but for scenarios where creation
and scheduling must be separated, the constructors may be used, and the task's
Start
method may then be used to schedule the task for execution at a later time.
All members of , except for
Dispose, are thread-safe
and may be used from multiple threads concurrently.
Represents an asynchronous operation.
instances may be created in a variety of ways. The most common approach is by
using the Task type's property to retrieve a instance that can be used to create tasks for several
purposes. For example, to create a that runs an action, the factory's StartNew
method may be used:
// C#
var t = Task.Factory.StartNew(() => DoAction());
' Visual Basic
Dim t = Task.Factory.StartNew(Function() DoAction())
The class also provides constructors that initialize the Task but that do not
schedule it for execution. For performance reasons, TaskFactory's StartNew method should be the
preferred mechanism for creating and scheduling computational tasks, but for scenarios where creation
and scheduling must be separated, the constructors may be used, and the task's
method may then be used to schedule the task for execution at a later time.
All members of , except for , are thread-safe
and may be used from multiple threads concurrently.
For operations that return values, the class
should be used.
For developers implementing custom debuggers, several internal and private members of Task may be
useful (these may change from release to release). The Int32 m_taskId field serves as the backing
store for the property, however accessing this field directly from a debugger may be
more efficient than accessing the same value through the property's getter method (the
s_taskIdCounter Int32 counter is used to retrieve the next available ID for a Task). Similarly, the
Int32 m_stateFlags field stores information about the current lifecycle stage of the Task,
information also accessible through the property. The m_action System.Object
field stores a reference to the Task's delegate, and the m_stateObject System.Object field stores the
async state passed to the Task by the developer. Finally, for debuggers that parse stack frames, the
InternalWait method serves a potential marker for when a Task is entering a wait operation.
A type initializer that runs with the appropriate permissions.
Initializes a new with the specified action.
The delegate that represents the code to execute in the Task.
The argument is null.
Initializes a new with the specified action and CancellationToken.
The delegate that represents the code to execute in the Task.
The CancellationToken
that will be assigned to the new Task.
The argument is null.
The provided CancellationToken
has already been disposed.
Initializes a new with the specified action and creation options.
The delegate that represents the code to execute in the task.
The TaskCreationOptions used to
customize the Task's behavior.
The argument is null.
The argument specifies an invalid value for .
Initializes a new with the specified action and creation options.
The delegate that represents the code to execute in the task.
The that will be assigned to the new task.
The TaskCreationOptions used to
customize the Task's behavior.
The argument is null.
The argument specifies an invalid value for .
The provided CancellationToken
has already been disposed.
Initializes a new with the specified action and state.
The delegate that represents the code to execute in the task.
An object representing data to be used by the action.
The argument is null.
Initializes a new with the specified action, state, snd options.
The delegate that represents the code to execute in the task.
An object representing data to be used by the action.
The that will be assigned to the new task.
The argument is null.
The provided CancellationToken
has already been disposed.
Initializes a new with the specified action, state, snd options.
The delegate that represents the code to execute in the task.
An object representing data to be used by the action.
The TaskCreationOptions used to
customize the Task's behavior.
The argument is null.
The argument specifies an invalid value for .
Initializes a new with the specified action, state, snd options.
The delegate that represents the code to execute in the task.
An object representing data to be used by the action.
The that will be assigned to the new task.
The TaskCreationOptions used to
customize the Task's behavior.
The argument is null.
The argument specifies an invalid value for .
The provided CancellationToken
has already been disposed.
An internal constructor used by the factory methods on task and its descendent(s).
This variant does not capture the ExecutionContext; it is up to the caller to do that.
An action to execute.
Optional state to pass to the action.
Parent of Task.
A CancellationToken for the task.
A task scheduler under which the task will run.
Options to control its execution.
Internal options to control its execution
Common logic used by the following internal ctors:
Task()
Task(object action, object state, Task parent, TaskCreationOptions options, TaskScheduler taskScheduler)
ASSUMES THAT m_creatingTask IS ALREADY SET.
Action for task to execute.
Object to which to pass to action (may be null)
Task scheduler on which to run thread (only used by continuation tasks).
A CancellationToken for the Task.
Options to customize behavior of Task.
Internal options to customize behavior of Task.
Checks if we registered a CT callback during construction, and deregisters it.
This should be called when we know the registration isn't useful anymore. Specifically from Finish() if the task has completed
successfully or with an exception.
Captures the ExecutionContext so long as flow isn't suppressed.
A stack crawl mark pointing to the frame of the caller.
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.
Starts the , scheduling it for execution to the current TaskScheduler.
A task may only be started and run only once. Any attempts to schedule a task a second time
will result in an exception.
The is not in a valid state to be started. It may have already been started,
executed, or canceled, or it may have been created in a manner that doesn't support direct
scheduling.
The instance has been disposed.
Starts the , scheduling it for execution to the specified TaskScheduler.
A task may only be started and run only once. Any attempts to schedule a task a second time will
result in an exception.
The TaskScheduler with which to associate
and execute this task.
The argument is null.
The is not in a valid state to be started. It may have already been started,
executed, or canceled, or it may have been created in a manner that doesn't support direct
scheduling.
The instance has been disposed.
Runs the synchronously on the current TaskScheduler.
A task may only be started and run only once. Any attempts to schedule a task a second time will
result in an exception.
Tasks executed with will be associated with the current TaskScheduler.
If the target scheduler does not support running this Task on the current thread, the Task will
be scheduled for execution on the scheduler, and the current thread will block until the
Task has completed execution.
The is not in a valid state to be started. It may have already been started,
executed, or canceled, or it may have been created in a manner that doesn't support direct
scheduling.
The instance has been disposed.
Runs the synchronously on the scheduler provided.
A task may only be started and run only once. Any attempts to schedule a task a second time will
result in an exception.
If the target scheduler does not support running this Task on the current thread, the Task will
be scheduled for execution on the scheduler, and the current thread will block until the
Task has completed execution.
The is not in a valid state to be started. It may have already been started,
executed, or canceled, or it may have been created in a manner that doesn't support direct
scheduling.
The instance has been disposed.
The parameter
is null.
The scheduler on which to attempt to run this task inline.
Throws an exception if the task has been disposed, and hence can no longer be accessed.
The task has been disposed.
Sets the internal completion event.
Disposes the , releasing all of its unmanaged resources.
Unlike most of the members of , this method is not thread-safe.
Also, may only be called on a that is in one of
the final states: RanToCompletion,
Faulted, or
Canceled.
The exception that is thrown if the is not in
one of the final states: RanToCompletion,
Faulted, or
Canceled.
Disposes the , releasing all of its unmanaged resources.
A Boolean value that indicates whether this method is being called due to a call to .
Unlike most of the members of , this method is not thread-safe.
Schedules the task for execution.
If true, TASK_STATE_STARTED bit is turned on in
an atomic fashion, making sure that TASK_STATE_CANCELED does not get set
underneath us. If false, TASK_STATE_STARTED bit is OR-ed right in. This
allows us to streamline things a bit for StartNew(), where competing cancellations
are not a problem.
Adds an exception to the list of exceptions this task has thrown.
An object representing either an Exception or a collection of Exceptions.
Returns a list of exceptions by aggregating the holder's contents. Or null if
no exceptions have been thrown.
Whether to include a TCE if cancelled.
An aggregate exception, or null if no exceptions have been caught.
Throws an aggregate exception if the task contains exceptions.
Checks whether this is an attached task, and whether we are being called by the parent task.
And sets the TASK_STATE_EXCEPTIONOBSERVEDBYPARENT status flag based on that.
This is meant to be used internally when throwing an exception, and when WaitAll is gathering
exceptions for tasks it waited on. If this flag gets set, the implicit wait on children
will skip exceptions to prevent duplication.
This should only be called when this task has completed with an exception
Signals completion of this particular task.
The bUserDelegateExecuted parameter indicates whether this Finish() call comes following the
full execution of the user delegate.
If bUserDelegateExecuted is false, it mean user delegate wasn't invoked at all (either due to
a cancellation request, or because this task is a promise style Task). In this case, the steps
involving child tasks (i.e. WaitForChildren) will be skipped.
FinishStageTwo is to be executed as soon as we known there are no more children to complete.
It can happen i) either on the thread that originally executed this task (if no children were spawned, or they all completed by the time this task's delegate quit)
ii) or on the thread that executed the last child.
Final stage of the task completion code path. Notifies the parent (if any) that another of its childre are done, and runs continuations.
This function is only separated out from FinishStageTwo because these two operations are also needed to be called from CancellationCleanupLogic()
This is called by children of this task when they are completed.
This is to be called just before the task does its final state transition.
It traverses the list of exceptional children, and appends their aggregate exceptions into this one's exception list
Special purpose Finish() entry point to be used when the task delegate throws a ThreadAbortedException
This makes a note in the state flags so that we avoid any costly synchronous operations in the finish codepath
such as inlined continuations
Indicates whether the ThreadAbortException was added to this task's exception holder.
This should always be true except for the case of non-root self replicating task copies.
Whether the delegate was executed.
Executes the task. This method will only be called once, and handles bookeeping associated with
self-replicating tasks, in addition to performing necessary exception marshaling.
The task has already been disposed.
IThreadPoolWorkItem override, which is the entry function for this task when the TP scheduler decides to run it.
Outermost entry function to execute this task. Handles all aspects of executing a task on the caller thread.
Currently this is called by IThreadPoolWorkItem.ExecuteWorkItem(), and TaskManager.TryExecuteInline.
Performs atomic updates to prevent double execution. Should only be set to true
in codepaths servicing user provided TaskSchedulers. The ConcRT or ThreadPool schedulers don't need this.
The actual code which invokes the body of the task. This can be overriden in derived types.
Alternate InnerInvoke prototype to be called from ExecuteSelfReplicating() so that
the Parallel Debugger can discover the actual task being invoked.
Details: Here, InnerInvoke is actually being called on the rootTask object while we are actually executing the
childTask. And the debugger needs to discover the childTask, so we pass that down as an argument.
The NoOptimization and NoInlining flags ensure that the childTask pointer is retained, and that this
function appears on the callstack.
Performs whatever handling is necessary for an unhandled exception. Normally
this just entails adding the exception to the holder object.
The exception that went unhandled.
Waits for the to complete execution.
The was canceled -or- an exception was thrown during
the execution of the .
The has been disposed.
Waits for the to complete execution.
A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
true if the completed execution within the allotted time; otherwise, false.
The was canceled -or- an exception was thrown during the execution of the .
is a negative number other than -1 milliseconds, which represents an
infinite time-out -or- timeout is greater than
.
The has been disposed.
Waits for the to complete execution.
A to observe while waiting for the task to complete.
The was canceled.
The was canceled -or- an exception was thrown during the execution of the .
The
has been disposed.
Waits for the to complete execution.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
true if the completed execution within the allotted time; otherwise,
false.
is a negative number other than -1, which represents an
infinite time-out.
The was canceled -or- an exception was thrown during the execution of the .
The
has been disposed.
Waits for the to complete execution.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
A to observe while waiting for the task to complete.
true if the completed execution within the allotted time; otherwise, false.
The was canceled -or- an exception was thrown during the execution of the .
The
has been disposed.
is a negative number other than -1, which represents an
infinite time-out.
The was canceled.
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.
Cancels the .
Indiactes whether we should only cancel non-invoked tasks.
For the default scheduler this option will only be serviced through TryDequeue.
For custom schedulers we also attempt an atomic state transition.
true if the task was successfully canceled; otherwise, false.
The
has been disposed.
Sets the task's cancellation acknowledged flag.
Runs all of the continuations, as appropriate.
Helper function to determine whether the current task is in the state desired by the
continuation kind under evaluation. Three possibilities exist: the task failed with
an unhandled exception (OnFailed), the task was canceled before running (OnAborted),
or the task completed successfully (OnCompletedSuccessfully). Note that the last
one includes completing due to cancellation.
The continuation options under evaluation.
True if the continuation should be run given the task's current state.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new continuation task.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The to associate with the continuation task and to use for its execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the continuation criteria specified through the parameter are not met, the continuation task will be canceled
instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
The that will be assigned to the new continuation task.
The to associate with the continuation task and to use for its
execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the criteria specified through the parameter
are not met, the continuation task will be canceled instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new continuation task.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The to associate with the continuation task and to use for its execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the continuation criteria specified through the parameter are not met, the continuation task will be canceled
instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new continuation task.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
The to associate with the continuation task and to use for its
execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the criteria specified through the parameter
are not met, the continuation task will be canceled instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Converts TaskContinuationOptions to TaskCreationOptions, and also does
some validity checking along the way.
Incoming TaskContinuationOptions
Outgoing TaskCreationOptions
Outgoing InternalTaskOptions
Registers the continuation and possibly runs it (if the task is already finished).
The continuation task itself.
TaskScheduler with which to associate continuation task.
Restrictions on when the continuation becomes active.
Waits for all of the provided objects to complete execution.
An array of instances on which to wait.
The argument is null.
The argument contains a null element.
At least one of the instances was canceled -or- an exception was thrown during
the execution of at least one of the instances.
The has been disposed.
Waits for all of the provided objects to complete execution.
true if all of the instances completed execution within the allotted time;
otherwise, false.
An array of instances on which to wait.
A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
The argument is null.
The argument contains a null element.
At least one of the instances was canceled -or- an exception was thrown during
the execution of at least one of the instances.
is a negative number other than -1 milliseconds, which represents an
infinite time-out -or- timeout is greater than
.
The has been disposed.
Waits for all of the provided objects to complete execution.
true if all of the instances completed execution within the allotted time;
otherwise, false.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
An array of instances on which to wait.
The argument is null.
The argument contains a null element.
At least one of the instances was canceled -or- an exception was thrown during
the execution of at least one of the instances.
The has been disposed.
is a negative number other than -1, which represents an
infinite time-out.
Waits for all of the provided objects to complete execution.
true if all of the instances completed execution within the allotted time;
otherwise, false.
An array of instances on which to wait.
A to observe while waiting for the tasks to complete.
The argument is null.
The argument contains a null element.
At least one of the instances was canceled -or- an exception was thrown during
the execution of at least one of the instances.
The was canceled.
The has been disposed.
Waits for all of the provided objects to complete execution.
true if all of the instances completed execution within the allotted time;
otherwise, false.
An array of instances on which to wait.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
A to observe while waiting for the tasks to complete.
The argument is null.
The argument contains a null element.
At least one of the instances was canceled -or- an exception was thrown during
the execution of at least one of the instances.
The has been disposed.
is a negative number other than -1, which represents an
infinite time-out.
The was canceled.
Waits for a set of handles in a STA-aware way. In other words, it will wait for each
of the events individually if we're on a STA thread, because MsgWaitForMultipleObjectsEx
can't do a true wait-all due to its hidden message queue event. This is not atomic,
of course, but we only wait on one-way (MRE) events anyway so this is OK.
An array of wait handles to wait on.
The timeout to use during waits.
The cancellationToken that enables a wait to be canceled.
True if all waits succeeded, false if a timeout occurred.
Internal WaitAll implementation which is meant to be used with small number of tasks,
optimized for Parallel.Invoke and other structured primitives.
This internal function is only meant to be called by WaitAll()
If the completed task is canceled or it has other exceptions, here we will add those
into the passed in exception list (which will be lazily initialized here).
Waits for any of the provided objects to complete execution.
An array of instances on which to wait.
The index of the completed task in the array argument.
The argument is null.
The argument contains a null element.
The has been disposed.
Waits for any of the provided objects to complete execution.
An array of instances on which to wait.
A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
The index of the completed task in the array argument, or -1 if the
timeout occurred.
The argument is null.
The argument contains a null element.
The has been disposed.
is a negative number other than -1 milliseconds, which represents an
infinite time-out -or- timeout is greater than
.
Waits for any of the provided objects to complete execution.
An array of instances on which to wait.
A to observe while waiting for a task to complete.
The index of the completed task in the array argument.
The argument is null.
The argument contains a null element.
The has been disposed.
The was canceled.
Waits for any of the provided objects to complete execution.
An array of instances on which to wait.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
The index of the completed task in the array argument, or -1 if the
timeout occurred.
The argument is null.
The argument contains a null element.
The has been disposed.
is a negative number other than -1, which represents an
infinite time-out.
Waits for any of the provided objects to complete execution.
An array of instances on which to wait.
The number of milliseconds to wait, or (-1) to
wait indefinitely.
A to observe while waiting for a task to complete.
The index of the completed task in the array argument, or -1 if the
timeout occurred.
The argument is null.
The argument contains a null element.
The has been disposed.
is a negative number other than -1, which represents an
infinite time-out.
The was canceled.
Gets a unique ID for this Task instance.
Task IDs are assigned on-demand and do not necessarily represent the order in the which Task
instances were created.
Returns the unique ID of the currently executing Task.
Gets the Task instance currently executing, or
null if none exists.
Gets the Exception that caused the Task to end prematurely. If the Task completed successfully or has not yet thrown any
exceptions, this will return null.
Tasks that throw unhandled exceptions store the resulting exception and propagate it wrapped in a
in calls to Wait
or in accesses to the property. Any exceptions not observed by the time
the Task instance is garbage collected will be propagated on the finalizer thread.
The Task
has been disposed.
Gets the TaskStatus of this Task.
Gets whether this Task instance has completed
execution due to being canceled.
A Task will complete in Canceled state either if its CancellationToken
was marked for cancellation before the task started executing, or if the task acknowledged the cancellation request on
its already signaled CancellationToken by throwing an
OperationCanceledException2 that bears the same
CancellationToken.
Returns true if this task has a cancellation token and it was signaled.
To be used internally in execute entry codepaths.
This internal property provides access to the CancellationToken that was set on the task
when it was constructed.
Gets whether this threw an OperationCanceledException2 while its CancellationToken was signaled.
Gets whether this Task has completed.
will return true when the Task is in one of the three
final states: RanToCompletion,
Faulted, or
Canceled.
Checks whether this task has been disposed.
Gets the TaskCreationOptions used
to create this task.
Gets a that can be used to wait for the task to
complete.
Using the wait functionality provided by
should be preferred over using for similar
functionality.
The has been disposed.
Gets the state object supplied when the Task was created,
or null if none was supplied.
Gets an indication of whether the asynchronous operation completed synchronously.
true if the asynchronous operation completed synchronously; otherwise, false.
Provides access to the TaskScheduler responsible for executing this Task.
Provides access to factory methods for creating and instances.
The factory returned from is a default instance
of , as would result from using
the default constructor on TaskFactory.
Provides an event that can be used to wait for completion.
Only called by Wait*(), which means that we really do need to instantiate a completion event.
Determines whether this is the root task of a self replicating group.
Determines whether the task is a replica itself.
The property formerly known as IsFaulted.
Gets whether the completed due to an unhandled exception.
If is true, the Task's will be equal to
TaskStatus.Faulted, and its
property will be non-null.
Checks whether the TASK_STATE_EXCEPTIONOBSERVEDBYPARENT status flag is set,
This will only be used by the implicit wait to prevent double throws
Checks whether the body was ever invoked. Used by task scheduler code to verify custom schedulers actually ran the task.
A structure to hold continuation information.
Constructs a new continuation structure.
The task to be activated.
The continuation options.
The scheduler to use for the continuation.
Invokes the continuation for the target completion task.
The completed task.
Whether the continuation can be inlined.
Initializes a new with the specified function.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
The argument is null.
Initializes a new with the specified function.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
The to be assigned to this task.
The argument is null.
The provided CancellationToken
has already been disposed.
Initializes a new with the specified function and creation options.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
The TaskCreationOptions used to
customize the task's behavior.
The argument is null.
The argument specifies an invalid value for .
Initializes a new with the specified function and creation options.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
The that will be assigned to the new task.
The TaskCreationOptions used to
customize the task's behavior.
The argument is null.
The argument specifies an invalid value for .
The provided CancellationToken
has already been disposed.
Initializes a new with the specified function and state.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
An object representing data to be used by the action.
The argument is null.
Initializes a new with the specified action, state, and options.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
An object representing data to be used by the function.
The to be assigned to the new task.
The argument is null.
The provided CancellationToken
has already been disposed.
Initializes a new with the specified action, state, and options.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
An object representing data to be used by the function.
The TaskCreationOptions used to
customize the task's behavior.
The argument is null.
The argument specifies an invalid value for .
Initializes a new with the specified action, state, and options.
The delegate that represents the code to execute in the task. When the function has completed,
the task's property will be set to return the result value of the function.
An object representing data to be used by the function.
The to be assigned to the new task.
The TaskCreationOptions used to
customize the task's behavior.
The argument is null.
The argument specifies an invalid value for .
The provided CancellationToken
has already been disposed.
Creates a new future object.
The parent task for this future.
A function that yields the future value.
The task scheduler which will be used to execute the future.
The CancellationToken for the task.
Options to control the future's behavior.
Internal options to control the future's behavior.
The argument specifies
a SelfReplicating , which is illegal."/>.
Creates a new future object.
The parent task for this future.
An object containing data to be used by the action; may be null.
A function that yields the future value.
The CancellationToken for the task.
The task scheduler which will be used to execute the future.
Options to control the future's behavior.
Internal options to control the future's behavior.
The argument specifies
a SelfReplicating , which is illegal."/>.
Evaluates the value selector of the Task which is passed in as an object and stores the result.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new continuation task.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The to associate with the continuation task and to use for its execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the continuation criteria specified through the parameter are not met, the continuation task will be canceled
instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The has been disposed.
Creates a continuation that executes when the target completes.
An action to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new continuation task.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
The to associate with the continuation task and to use for its
execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed. If the criteria specified through the parameter
are not met, the continuation task will be canceled instead of scheduled.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
A new continuation .
The returned will not be scheduled for execution until the current
task has completed, whether it completes due to running to completion successfully, faulting due
to an unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The that will be assigned to the new task.
A new continuation .
The returned will not be scheduled for execution until the current
task has completed, whether it completes due to running to completion successfully, faulting due
to an unhandled exception, or exiting out early due to being canceled.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
The to associate with the continuation task and to use for its execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The argument is null.
The argument is null.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be
passed the completed task as an argument.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
A new continuation .
The returned will not be scheduled for execution until the current
task has completed, whether it completes due to running to completion successfully, faulting due
to an unhandled exception, or exiting out early due to being canceled.
The , when executed, should return a . This task's completion state will be transferred to the task returned
from the ContinueWith call.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The has been disposed.
Creates a continuation that executes when the target completes.
The type of the result produced by the continuation.
A function to run when the completes. When run, the delegate will be passed as
an argument this completed task.
The that will be assigned to the new task.
Options for when the continuation is scheduled and how it behaves. This includes criteria, such
as OnlyOnCanceled, as
well as execution options, such as ExecuteSynchronously.
The to associate with the continuation task and to use for its
execution.
A new continuation .
The returned will not be scheduled for execution until the current task has
completed, whether it completes due to running to completion successfully, faulting due to an
unhandled exception, or exiting out early due to being canceled.
The , when executed, should return a .
This task's completion state will be transferred to the task returned from the
ContinueWith call.
The argument is null.
The argument specifies an invalid value for TaskContinuationOptions.
The argument is null.
The has been disposed.
The provided CancellationToken
has already been disposed.
Gets the result value of this .
The get accessor for this property ensures that the asynchronous operation is complete before
returning. Once the result of the computation is available, it is stored and will be returned
immediately on later calls to .
Provides access to factory methods for creating instances.
The factory returned from is a default instance
of , as would result from using
the default constructor on the factory type.
Provides support for creating and scheduling
Task{TResult} objects.
The type of the results that are available though
the Task{TResult} objects that are associated with
the methods in this class.
There are many common patterns for which tasks are relevant. The
class encodes some of these patterns into methods that pick up default settings, which are
configurable through its constructors.
A default instance of is available through the
Task{TResult}.Factory property.
Initializes a instance with the default configuration.
This constructor creates a instance with a default configuration. The
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the default configuration.
The default that will be assigned
to tasks created by this unless another CancellationToken is explicitly specified
while calling the factory methods.
This constructor creates a instance with a default configuration. The
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The
TaskScheduler to use to schedule any tasks created with this TaskFactory{TResult}. A null value
indicates that the current TaskScheduler should be used.
With this constructor, the
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to , unless it's null, in which case the property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The default
TaskCreationOptions to use when creating tasks with this TaskFactory{TResult}.
The default
TaskContinuationOptions to use when creating continuation tasks with this TaskFactory{TResult}.
The exception that is thrown when the
argument or the
argument specifies an invalid value.
With this constructor, the
property is initialized to ,
the
property is initialized to , and the TaskScheduler property is initialized to the
current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The default that will be assigned
to tasks created by this unless another CancellationToken is explicitly specified
while calling the factory methods.
The default
TaskCreationOptions to use when creating tasks with this TaskFactory{TResult}.
The default
TaskContinuationOptions to use when creating continuation tasks with this TaskFactory{TResult}.
The default
TaskScheduler to use to schedule any Tasks created with this TaskFactory{TResult}. A null value
indicates that TaskScheduler.Current should be used.
The exception that is thrown when the
argument or the
argumentspecifies an invalid value.
With this constructor, the
property is initialized to ,
the
property is initialized to , and the TaskScheduler property is initialized to
, unless it's null, in which case the property is initialized to the
current scheduler (see TaskScheduler.Current).
Creates and starts a .
A function delegate that returns the future result to be available through
the .
The started .
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
The that will be assigned to the new task.
The started .
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
A TaskCreationOptions value that controls the behavior of the
created
.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
A TaskCreationOptions value that controls the behavior of the
created
.
The that will be assigned to the new task.
The TaskScheduler
that is used to schedule the created
Task{TResult}.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The started .
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The that will be assigned to the new task.
The started .
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
A TaskCreationOptions value that controls the behavior of the
created
.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The that will be assigned to the new task.
A TaskCreationOptions value that controls the behavior of the
created
.
The TaskScheduler
that is used to schedule the created
Task{TResult}.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
A Task that represents the
asynchronous operation.
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the
asynchronous operation.
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The TaskScheduler
that is used to schedule the task that executes the end method.
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the
asynchronous operation.
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The function delegate to execute when all tasks in
the array have completed.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The function delegate to execute when all tasks in
the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The function delegate to execute when all tasks in the array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The function delegate to execute when all tasks in the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the array completes.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Gets the default CancellationToken of this
TaskFactory.
This property returns the default that will be assigned to all
tasks created by this factory unless another CancellationToken value is explicitly specified
during the call to the factory methods.
Gets the TaskScheduler of this
TaskFactory{TResult}.
This property returns the default scheduler for this factory. It will be used to schedule all
tasks unless another scheduler is explicitly specified during calls to this factory's methods.
If null, TaskScheduler.Current
will be used.
Gets the TaskCreationOptions
value of this TaskFactory{TResult}.
This property returns the default creation options for this factory. They will be used to create all
tasks unless other options are explicitly specified during calls to this factory's methods.
Gets the TaskContinuationOptions
value of this TaskFactory{TResult}.
This property returns the default continuation options for this factory. They will be used to create
all continuation tasks unless other options are explicitly specified during calls to this factory's methods.
Represents the current stage in the lifecycle of a .
The task has been initialized but has not yet been scheduled.
The task is waiting to be activated and scheduled internally by the .NET Framework infrastructure.
The task has been scheduled for execution but has not yet begun executing.
The task is running but has not yet completed.
The task has finished executing and is implicitly waiting for
attached child tasks to complete.
The task completed execution successfully.
The task acknowledged cancellation by throwing an OperationCanceledException2 with its own CancellationToken
while the token was in signaled state, or the task's CancellationToken was already signaled before the
task started executing.
The task completed due to an unhandled exception.
Specifies flags that control optional behavior for the creation and execution of tasks.
Specifies that the default behavior should be used.
A hint to a TaskScheduler to schedule a
task in as fair a manner as possible, meaning that tasks scheduled sooner will be more likely to
be run sooner, and tasks scheduled later will be more likely to be run later.
Specifies that a task will be a long-running, course-grained operation. It provides a hint to the
TaskScheduler that oversubscription may be
warranted.
Specifies that a task is attached to a parent in the task hierarchy.
Task creation flags which are only used internally.
Specifies "No internal task options"
Used to filter out internal vs. public task creation options.
Specifies that the task will be queued by the runtime before handing it over to the user.
This flag will be used to skip the cancellationtoken registration step, which is only meant for unstarted tasks.
Specifies flags that control optional behavior for the creation and execution of continuation tasks.
Default = "Continue on any, no task options, run asynchronously"
Specifies that the default behavior should be used. Continuations, by default, will
be scheduled when the antecedent task completes, regardless of the task's final TaskStatus.
A hint to a TaskScheduler to schedule a
task in as fair a manner as possible, meaning that tasks scheduled sooner will be more likely to
be run sooner, and tasks scheduled later will be more likely to be run later.
Specifies that a task will be a long-running, course-grained operation. It provides
a hint to the TaskScheduler that
oversubscription may be warranted.
Specifies that a task is attached to a parent in the task hierarchy.
Specifies that the continuation task should not be scheduled if its antecedent ran to completion.
This option is not valid for multi-task continuations.
Specifies that the continuation task should not be scheduled if its antecedent threw an unhandled
exception. This option is not valid for multi-task continuations.
Specifies that the continuation task should not be scheduled if its antecedent was canceled. This
option is not valid for multi-task continuations.
Specifies that the continuation task should be scheduled only if its antecedent ran to
completion. This option is not valid for multi-task continuations.
Specifies that the continuation task should be scheduled only if its antecedent threw an
unhandled exception. This option is not valid for multi-task continuations.
Specifies that the continuation task should be scheduled only if its antecedent was canceled.
This option is not valid for multi-task continuations.
Specifies that the continuation task should be executed synchronously. With this option
specified, the continuation will be run on the same thread that causes the antecedent task to
transition into its final state. If the antecedent is already complete when the continuation is
created, the continuation will run on the thread creating the continuation. Only very
short-running continuations should be executed synchronously.
Represents an exception used to communicate task cancellation.
Initializes a new instance of the class.
Initializes a new instance of the
class with a specified error message.
The error message that explains the reason for the exception.
Initializes a new instance of the
class with a specified error message and a reference to the inner exception that is the cause of
this exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception.
Initializes a new instance of the class
with a reference to the that has been canceled.
A task that has been canceled.
Gets the task associated with this exception.
It is permissible for no Task to be associated with a
, in which case
this property will return null.
Represents the producer side of a unbound to a
delegate, providing access to the consumer side through the property.
It is often the case that a is desired to
represent another asynchronous operation.
TaskCompletionSource is provided for this purpose. It enables
the creation of a task that can be handed out to consumers, and those consumers can use the members
of the task as they would any other. However, unlike most tasks, the state of a task created by a
TaskCompletionSource is controlled explicitly by the methods on TaskCompletionSource. This enables the
completion of the external asynchronous operation to be propagated to the underlying Task. The
separation also ensures that consumers are not able to transition the state without access to the
corresponding TaskCompletionSource.
All members of are thread-safe
and may be used from multiple threads concurrently.
The type of the result value assocatied with this .
Creates a .
Creates a
with the specified options.
The created
by this instance and accessible through its property
will be instantiated using the specified .
The options to use when creating the underlying
.
The represent options invalid for use
with a .
Creates a
with the specified state.
The state to use as the underlying
's AsyncState.
Creates a with
the specified state and options.
The options to use when creating the underlying
.
The state to use as the underlying
's AsyncState.
The represent options invalid for use
with a .
Attempts to transition the underlying
into the
Faulted
state.
The exception to bind to this .
True if the operation was successful; otherwise, false.
This operation will return false if the
is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The argument is null.
The was disposed.
Attempts to transition the underlying
into the
Faulted
state.
The collection of exceptions to bind to this .
True if the operation was successful; otherwise, false.
This operation will return false if the
is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The argument is null.
There are one or more null elements in .
The collection is empty.
The was disposed.
Transitions the underlying
into the
Faulted
state.
The exception to bind to this .
The argument is null.
The underlying is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Transitions the underlying
into the
Faulted
state.
The collection of exceptions to bind to this .
The argument is null.
There are one or more null elements in .
The underlying is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Attempts to transition the underlying
into the
RanToCompletion
state.
The result value to bind to this .
True if the operation was successful; otherwise, false.
This operation will return false if the
is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Transitions the underlying
into the
RanToCompletion
state.
The result value to bind to this .
The underlying is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Transitions the underlying
into the
Canceled
state.
The underlying is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Attempts to transition the underlying
into the
Canceled
state.
True if the operation was successful; otherwise, false.
This operation will return false if the
is already in one
of the three final states:
RanToCompletion,
Faulted, or
Canceled.
The was disposed.
Gets the created
by this .
This property enables a consumer access to the that is controlled by this instance.
The , ,
, and
methods (and their "Try" variants) on this instance all result in the relevant state
transitions on this underlying Task.
An exception holder manages a list of exceptions for one particular task.
It offers the ability to aggregate, but more importantly, also offers intrinsic
support for propagating unhandled exceptions that are never observed. It does
this by aggregating and throwing if the holder is ever GC'd without the holder's
contents ever having been requested (e.g. by a Task.Wait, Task.get_Exception, etc).
Creates a new holder; it will be registered for finalization.
The task this holder belongs to.
A finalizer that repropagates unhandled exceptions.
Add an exception to the internal list. This will ensure the holder is
in the proper state (handled/unhandled) depending on the list's contents.
An exception object (either an Exception or an
IEnumerable{Exception}) to add to the list.
A private helper method that ensures the holder is considered
unhandled, i.e. it is registered for finalization.
A private helper method that ensures the holder is considered
handled, i.e. it is not registered for finalization.
Whether this is called from the finalizer thread.
Allocates a new aggregate exception and adds the contents of the list to
it. By calling this method, the holder assumes exceptions to have been
"observed", such that the finalization check will be subsequently skipped.
Whether this is being called from a finalizer.
An extra exception to be included (optionally).
The aggregate exception to throw.
Provides a set of static (Shared in Visual Basic) methods for working with specific kinds of
instances.
Creates a proxy Task that represents the
asynchronous operation of a Task{Task}.
It is often useful to be able to return a Task from a
Task{TResult}, where the inner Task represents work done as part of the outer Task{TResult}. However,
doing so results in a Task{Task}, which, if not dealt with carefully, could produce unexpected behavior. Unwrap
solves this problem by creating a proxy Task that represents the entire asynchronous operation of such a Task{Task}.
The Task{Task} to unwrap.
The exception that is thrown if the
argument is null.
A Task that represents the asynchronous operation of the provided Task{Task}.
Creates a proxy Task{TResult} that represents the
asynchronous operation of a Task{Task{TResult}}.
It is often useful to be able to return a Task{TResult} from a Task{TResult}, where the inner Task{TResult}
represents work done as part of the outer Task{TResult}. However, doing so results in a Task{Task{TResult}},
which, if not dealt with carefully, could produce unexpected behavior. Unwrap solves this problem by
creating a proxy Task{TResult} that represents the entire asynchronous operation of such a Task{Task{TResult}}.
The Task{Task{TResult}} to unwrap.
The exception that is thrown if the
argument is null.
A Task{TResult} that represents the asynchronous operation of the provided Task{Task{TResult}}. /// Unwraps a Task that returns another Task.
Provides support for creating and scheduling
Tasks.
There are many common patterns for which tasks are relevant. The
class encodes some of these patterns into methods that pick up default settings, which are
configurable through its constructors.
A default instance of is available through the
Task.Factory property.
Initializes a instance with the default configuration.
This constructor creates a instance with a default configuration. The
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The default that will be assigned
to tasks created by this unless another CancellationToken is explicitly specified
while calling the factory methods.
This constructor creates a instance with a default configuration. The
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The
TaskScheduler to use to schedule any tasks created with this TaskFactory. A null value
indicates that the current TaskScheduler should be used.
With this constructor, the
property is initialized to
TaskCreationOptions.None, the
property is initialized to TaskContinuationOptions.None,
and the TaskScheduler property is
initialized to , unless it's null, in which case the property is
initialized to the current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The default
TaskCreationOptions to use when creating tasks with this TaskFactory.
The default
TaskContinuationOptions to use when creating continuation tasks with this TaskFactory.
The exception that is thrown when the
argument or the
argument specifies an invalid value.
With this constructor, the
property is initialized to ,
the
property is initialized to , and the TaskScheduler property is initialized to the
current scheduler (see TaskScheduler.Current).
Initializes a instance with the specified configuration.
The default that will be assigned
to tasks created by this unless another CancellationToken is explicitly specified
while calling the factory methods.
The default
TaskCreationOptions to use when creating tasks with this TaskFactory.
The default
TaskContinuationOptions to use when creating continuation tasks with this TaskFactory.
The default
TaskScheduler to use to schedule any Tasks created with this TaskFactory. A null value
indicates that TaskScheduler.Current should be used.
The exception that is thrown when the
argument or the
argumentspecifies an invalid value.
With this constructor, the
property is initialized to ,
the
property is initialized to , and the TaskScheduler property is initialized to
, unless it's null, in which case the property is initialized to the
current scheduler (see TaskScheduler.Current).
Creates and starts a Task.
The action delegate to execute asynchronously.
The started Task.
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors
and then calling
Start to schedule it for execution. However,
unless creation and scheduling must be separated, StartNew is the recommended
approach for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
The that will be assigned to the new task.
The started Task.
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors
and then calling
Start to schedule it for execution. However,
unless creation and scheduling must be separated, StartNew is the recommended
approach for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
A TaskCreationOptions value that controls the behavior of the
created
Task.
The started Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
The that will be assigned to the new
A TaskCreationOptions value that controls the behavior of the
created
Task.
The TaskScheduler
that is used to schedule the created Task.
The started Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
An object containing data to be used by the
delegate.
The started Task.
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
An object containing data to be used by the
delegate.
The that will be assigned to the new
The started Task.
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
An object containing data to be used by the
delegate.
A TaskCreationOptions value that controls the behavior of the
created
Task.
The started Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a Task.
The action delegate to execute asynchronously.
An object containing data to be used by the
delegate.
The that will be assigned to the new task.
A TaskCreationOptions value that controls the behavior of the
created
Task.
The TaskScheduler
that is used to schedule the created Task.
The started Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a Task using one of its constructors and
then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
The started .
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
The that will be assigned to the new
The started .
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
A TaskCreationOptions value that controls the behavior of the
created
.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
The that will be assigned to the new task.
A TaskCreationOptions value that controls the behavior of the
created
.
The TaskScheduler
that is used to schedule the created
Task{TResult}.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The started .
The exception that is thrown when the
argument is null.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The that will be assigned to the new
The started .
The exception that is thrown when the
argument is null.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
A TaskCreationOptions value that controls the behavior of the
created
.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates and starts a .
The type of the result available through the
Task.
A function delegate that returns the future result to be available through
the .
An object containing data to be used by the
delegate.
The that will be assigned to the new task.
A TaskCreationOptions value that controls the behavior of the
created
.
The TaskScheduler
that is used to schedule the created
Task{TResult}.
The started .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The provided CancellationToken
has already been disposed.
Calling StartNew is functionally equivalent to creating a using one
of its constructors and then calling
Start to schedule it for execution.
However, unless creation and scheduling must be separated, StartNew is the recommended approach
for both simplicity and performance.
Creates a Task that executes an end method action
when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The action delegate that processes the completed .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
A Task that represents the asynchronous
operation.
Creates a Task that executes an end method action
when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The action delegate that processes the completed .
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the asynchronous
operation.
Creates a Task that executes an end method action
when a specified IAsyncResult completes.
The IAsyncResult whose completion should trigger the processing of the
.
The action delegate that processes the completed .
The TaskScheduler
that is used to schedule the task that executes the end method.
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the asynchronous
operation.
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The type of the second argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The type of the second argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of begin
and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the
delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that represents the
asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The type of the result available through the
Task.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
A Task that represents the
asynchronous operation.
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The type of the result available through the
Task.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the
asynchronous operation.
Creates a Task that executes an end
method function when a specified IAsyncResult completes.
The type of the result available through the
Task.
The IAsyncResult whose completion should trigger the processing of the
.
The function delegate that processes the completed .
The TaskScheduler
that is used to schedule the task that executes the end method.
The TaskCreationOptions value that controls the behavior of the
created Task.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
A Task that represents the
asynchronous operation.
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Creates a Task that represents a pair of
begin and end methods that conform to the Asynchronous Programming Model pattern.
The type of the first argument passed to the delegate.
The type of the second argument passed to
delegate.
The type of the third argument passed to
delegate.
The type of the result available through the
Task.
The delegate that begins the asynchronous operation.
The delegate that ends the asynchronous operation.
The first argument passed to the
delegate.
The second argument passed to the
delegate.
The third argument passed to the
delegate.
The TaskCreationOptions value that controls the behavior of the
created Task.
An object containing data to be used by the
delegate.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument specifies an invalid TaskCreationOptions
value.
The created Task that
represents the asynchronous operation.
This method throws any exceptions thrown by the .
Check validity of options passed to FromAsync method
The options to be validated.
determines type of FromAsync method that called this method
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The action delegate to execute when all tasks in
the array have completed.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The action delegate to execute when all tasks in
the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The action delegate to execute when all tasks in the array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The array of tasks from which to continue.
The action delegate to execute when all tasks in the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The action delegate to execute when all tasks in
the array have completed.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The action delegate to execute when all tasks in
the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The action delegate to execute when all tasks in the array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result of the antecedent .
The array of tasks from which to continue.
The action delegate to execute when all tasks in the array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of a set of provided Tasks.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue.
The function delegate to execute when all tasks in the
array have completed.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAll.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the array completes.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation Task.
The new continuation Task.
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result that is returned by the
delegate and associated with the created .
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The function delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the
array completes.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the
array completes.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Creates a continuation Task
that will be started upon the completion of any Task in the provided set.
The type of the result of the antecedent .
The array of tasks from which to continue when one task completes.
The action delegate to execute when one task in the
array completes.
The CancellationToken
that will be assigned to the new continuation task.
The
TaskContinuationOptions value that controls the behavior of
the created continuation Task.
The TaskScheduler
that is used to schedule the created continuation .
The new continuation .
The exception that is thrown when the
array is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
argument is null.
The exception that is thrown when the
array contains a null value.
The exception that is thrown when the
array is empty.
The exception that is thrown when the
argument specifies an invalid TaskContinuationOptions
value.
The exception that is thrown when one
of the elements in the array has been disposed.
The provided CancellationToken
has already been disposed.
The NotOn* and OnlyOn* TaskContinuationOptions,
which constrain for which TaskStatus states a continuation
will be executed, are illegal with ContinueWhenAny.
Gets the default CancellationToken of this
TaskFactory.
This property returns the default that will be assigned to all
tasks created by this factory unless another CancellationToken value is explicitly specified
during the call to the factory methods.
Gets the TaskScheduler of this
TaskFactory.
This property returns the default scheduler for this factory. It will be used to schedule all
tasks unless another scheduler is explicitly specified during calls to this factory's methods.
If null, TaskScheduler.Current
will be used.
Gets the TaskCreationOptions
value of this TaskFactory.
This property returns the default creation options for this factory. They will be used to create all
tasks unless other options are explicitly specified during calls to this factory's methods.
Gets the TaskContinuationOptions
value of this TaskFactory.
This property returns the default continuation options for this factory. They will be used to create
all continuation tasks unless other options are explicitly specified during calls to this factory's methods.
Represents an abstract scheduler for tasks.
TaskScheduler acts as the extension point for all
pluggable scheduling logic. This includes mechanisms such as how to schedule a task for execution, and
how scheduled tasks should be exposed to debuggers.
All members of the abstract type are thread-safe
and may be used from multiple threads concurrently.
Queues a Task to the scheduler.
A class derived from TaskScheduler
implements this method to accept tasks being scheduled on the scheduler.
A typical implementation would store the task in an internal data structure, which would
be serviced by threads that would execute those tasks at some time in the future.
This method is only meant to be called by the .NET Framework and
should not be called directly by the derived class. This is necessary
for maintaining the consistency of the system.
The Task to be queued.
The argument is null.
Determines whether the provided Task
can be executed synchronously in this call, and if it can, executes it.
A class derived from TaskScheduler implements this function to
support inline execution of a task on a thread that initiates a wait on that task object. Inline
execution is optional, and the request may be rejected by returning false. However, better
scalability typically results the more tasks that can be inlined, and in fact a scheduler that
inlines too little may be prone to deadlocks. A proper implementation should ensure that a
request executing under the policies guaranteed by the scheduler can successfully inline. For
example, if a scheduler uses a dedicated thread to execute tasks, any inlining requests from that
thread should succeed.
If a scheduler decides to perform the inline execution, it should do so by calling to the base
TaskScheduler's
TryExecuteTask method with the provided task object, propagating
the return value. It may also be appropriate for the scheduler to remove an inlined task from its
internal data structures if it decides to honor the inlining request. Note, however, that under
some circumstances a scheduler may be asked to inline a task that was not previously provided to
it with the method.
The derived scheduler is responsible for making sure that the calling thread is suitable for
executing the given task as far as its own scheduling and execution policies are concerned.
The Task to be
executed.
A Boolean denoting whether or not task has previously been
queued. If this parameter is True, then the task may have been previously queued (scheduled); if
False, then the task is known not to have been queued, and this call is being made in order to
execute the task inline without queueing it.
A Boolean value indicating whether the task was executed inline.
The argument is
null.
The was already
executed.
Generates an enumerable of Task instances
currently queued to the scheduler waiting to be executed.
A class derived from implements this method in order to support
integration with debuggers. This method will only be invoked by the .NET Framework when the
debugger requests access to the data. The enumerable returned will be traversed by debugging
utilities to access the tasks currently queued to this scheduler, enabling the debugger to
provide a representation of this information in the user interface.
It is important to note that, when this method is called, all other threads in the process will
be frozen. Therefore, it's important to avoid synchronization with other threads that may lead to
blocking. If synchronization is necessary, the method should prefer to throw a
than to block, which could cause a debugger to experience delays. Additionally, this method and
the enumerable returned must not modify any globally visible state.
The returned enumerable should never be null. If there are currently no queued tasks, an empty
enumerable should be returned instead.
For developers implementing a custom debugger, this method shouldn't be called directly, but
rather this functionality should be accessed through the internal wrapper method
GetScheduledTasksForDebugger:
internal Task[] GetScheduledTasksForDebugger(). This method returns an array of tasks,
rather than an enumerable. In order to retrieve a list of active schedulers, a debugger may use
another internal method: internal static TaskScheduler[] GetTaskSchedulersForDebugger().
This static method returns an array of all active TaskScheduler instances.
GetScheduledTasksForDebugger then may be used on each of these scheduler instances to retrieve
the list of scheduled tasks for each.
An enumerable that allows traversal of tasks currently queued to this scheduler.
This scheduler is unable to generate a list of queued tasks at this time.
Retrieves some thread static state that can be cached and passed to multiple
TryRunInline calls, avoiding superflous TLS fetches.
A bag of TLS state (or null if none exists).
Attempts to execute the target task synchronously.
The task to run.
True if the task may have been previously queued,
false if the task was absolutely not previously queued.
The state retrieved from GetThreadStatics
True if it ran, false otherwise.
Attempts to dequeue a Task that was previously queued to
this scheduler.
The Task to be dequeued.
A Boolean denoting whether the argument was successfully dequeued.
The argument is null.
Notifies the scheduler that a work item has made progress.
Initializes the .
Frees all resources associated with this scheduler.
Creates a
associated with the current .
All Task instances queued to
the returned scheduler will be executed through a call to the
Post method
on that context.
A associated with
the current SynchronizationContext, as
determined by SynchronizationContext.Current.
The current SynchronizationContext may not be used as a TaskScheduler.
Attempts to execute the provided Task
on this scheduler.
Scheduler implementations are provided with Task
instances to be executed through either the method or the
method. When the scheduler deems it appropriate to run the
provided task, should be used to do so. TryExecuteTask handles all
aspects of executing a task, including action invocation, exception handling, state management,
and lifecycle control.
must only be used for tasks provided to this scheduler by the .NET
Framework infrastructure. It should not be used to execute arbitrary tasks obtained through
custom mechanisms.
A Task object to be executed.
The is not associated with this scheduler.
A Boolean that is true if was successfully executed, false if it
was not. A common reason for execution failure is that the task had previously been executed or
is in the process of being executed by another thread.
Provides an array of all queued Task instances
for the debugger.
The returned array is populated through a call to .
Note that this function is only meant to be invoked by a debugger remotely.
It should not be called by any other codepaths.
An array of Task instances.
This scheduler is unable to generate a list of queued tasks at this time.
Provides an array of all active TaskScheduler
instances for the debugger.
This function is only meant to be invoked by a debugger remotely.
It should not be called by any other codepaths.
An array of TaskScheduler instances.
Registers a new TaskScheduler instance in the global collection of schedulers.
Removes a TaskScheduler instance from the global collection of schedulers.
Indicates the maximum concurrency level this
is able to support.
Indicates whether this is a custom scheduler, in which case the safe code paths will be taken upon task entry
using a CAS to transition from queued state to executing.
Gets the default TaskScheduler instance.
Gets the TaskScheduler
associated with the currently executing task.
When not called from within a task, will return the scheduler.
Gets the unique ID for this .
Occurs when a faulted 's unobserved exception is about to trigger exception escalation
policy, which, by default, would terminate the process.
This AppDomain-wide event provides a mechanism to prevent exception
escalation policy (which, by default, terminates the process) from triggering.
Each handler is passed a
instance, which may be used to examine the exception and to mark it as observed.
Nested class that provides debugger view for TaskScheduler
Default thread pool scheduler.
A TaskScheduler implementation that executes all tasks queued to it through a call to
on the
that its associated with. The default constructor for this class binds to the current
Constructs a SynchronizationContextTaskScheduler associated with
This constructor expects to be set.
Implemetation of for this scheduler class.
Simply posts the tasks to be executed on the associated .
Implementation of for this scheduler class.
The task will be executed inline only if the call happens within
the associated .
Implementes the property for
this scheduler class.
By default it returns 1, because a based
scheduler only supports execution on a single thread.
Provides data for the event that is raised when a faulted 's
exception goes unobserved.
The Exception property is used to examine the exception without marking it
as observed, whereas the method is used to mark the exception
as observed. Marking the exception as observed prevents it from triggering exception escalation policy
which, by default, terminates the process.
Initializes a new instance of the class
with the unobserved exception.
The Exception that has gone unobserved.
Marks the as "observed," thus preventing it
from triggering exception escalation policy which, by default, terminates the process.
Gets whether this exception has been marked as "observed."
The Exception that went unobserved.
Represents an exception used to communicate an invalid operation by a
.
Initializes a new instance of the class.
Initializes a new instance of the
class with a specified error message.
The error message that explains the reason for the exception.
Initializes a new instance of the
class using the default error message and a reference to the inner exception that is the cause of
this exception.
The exception that is the cause of the current exception.
Initializes a new instance of the
class with a specified error message and a reference to the inner exception that is the cause of
this exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception.