Microsoft.VisualStudio.Threading
Reserved to be used by the compiler for tracking metadata.
This class should not be used by developers in source code.
This definition is provided by the IsExternalInit NuGet package (https://www.nuget.org/packages/IsExternalInit).
Please see https://github.com/manuelroemer/IsExternalInit for more information.
An asynchronous implementation of an AutoResetEvent.
A queue of folks awaiting signals.
Whether to complete the task synchronously in the method,
as opposed to asynchronously.
A reusable delegate that points to the method.
A value indicating whether this event is already in a signaled state.
This should not need the volatile modifier because it is
always accessed within a lock.
Initializes a new instance of the class
that does not inline awaiters.
Initializes a new instance of the class.
A value indicating whether to complete the task synchronously in the method,
as opposed to asynchronously. better simulates the behavior of the
class, but can result in slightly better performance.
Returns an awaitable that may be used to asynchronously acquire the next signal.
An awaitable.
Returns an awaitable that may be used to asynchronously acquire the next signal.
A token whose cancellation removes the caller from the queue of those waiting for the event.
An awaitable.
Unblocks one waiter or sets the signal if no waiters are present so the next waiter may proceed immediately.
Responds to cancellation requests by removing the request from the waiter queue.
The passed in to the method.
Tracks someone waiting for a signal from the event.
Initializes a new instance of the class.
The event that is initializing this value.
to allow continuations to be inlined upon the completer's callstack.
The cancellation token associated with the waiter.
Gets the provided by the waiter.
Gets the registration to dispose of when the waiter receives their event.
An asynchronous barrier that blocks the signaler until all other participants have signaled.
The number of participants being synchronized.
The set of participants who have reached the barrier, with their awaiters that can resume those participants.
Initializes a new instance of the class.
The number of participants.
Signals that a participant is ready, and returns a Task
that completes when all other participants have also signaled ready.
A Task, which will complete (or may already be completed) when the last participant calls this method.
An asynchronous style countdown event.
The manual reset event we use to signal all awaiters.
The remaining number of signals required before we can unblock waiters.
Initializes a new instance of the class.
The number of signals required to unblock awaiters.
Returns an awaitable that executes the continuation when the countdown reaches zero.
An awaitable.
Decrements the counter by one.
A task that completes when the signal has been set if this call causes the count to reach zero.
If the count is not zero, a completed task is returned.
On .NET versions prior to 4.6:
This method may return before the signal set has propagated.
The returned task completes when the signal has definitely been set.
On .NET 4.6 and later:
This method is not asynchronous. The returned Task is always completed.
Decrements the counter by one.
Decrements the counter by one and returns an awaitable that executes the continuation when the countdown reaches zero.
An awaitable.
A mutex that can be entered asynchronously.
This class utilizes the OS mutex synchronization primitive, which is fundamentally thread-affinitized and requires synchronously blocking the thread that will own the mutex.
This makes a native mutex unsuitable for use in async methods, where the thread that enters the mutex may not be the same thread that exits it.
This class solves that problem by using a private dedicated thread to enter and release the mutex, but otherwise allows its owner to execute async code, switch threads, etc.
Initializes a new instance of the class.
A non-empty name for the mutex, which follows standard mutex naming rules.
This name will share a namespace with other processes in the system and collisions will result in the processes sharing a single mutex across processes.
See the help docs on the underlying class for more information on the parameter.
Consider when reading that the initiallyOwned parameter for that constructor is always for this class.
Gets the name of the mutex.
Disposes of the underlying native objects.
Acquires the mutex asynchronously.
The maximum time to wait before timing out. Use for no timeout, or to acquire the mutex only if it is immediately available.
A value whose disposal will release the mutex.Thrown from the awaited result if the mutex could not be acquired within the specified timeout.Thrown from the awaited result if the is a negative number other than -1 milliseconds, which represents an infinite timeout.Thrown if called before a prior call to this method has completed, with its releaser disposed if the mutex was entered.
Acquires the mutex asynchronously, allowing for timeouts without throwing exceptions.
The maximum time to wait before timing out. Use for no timeout, or to acquire the mutex only if it is immediately available.
If the mutex was acquired, the result is a value whose disposal will release the mutex.
In the event of a timeout, the result in a value.
Thrown from the awaited result if the is a negative number other than -1 milliseconds, which represents an infinite timeout.Thrown if called before a prior call to this method has completed, with its releaser disposed if the mutex was entered.
The value returned from that must be disposed to release the mutex.
Gets a value indicating whether the mutex was abandoned by its previous owner.
Releases the named mutex.
An asynchronous event handler.
The sender of the event.
Event arguments.
A task whose completion signals handling is finished.
An asynchronous event handler.
The type of event arguments.
The sender of the event.
Event arguments.
A task whose completion signals handling is finished.
Lazily executes a delegate that has some side effect (typically initializing something)
such that the delegate runs at most once.
The lazy instance we use internally for the bulk of the behavior we want.
Initializes a new instance of the class.
The action to perform at most once, that has some desirable side-effect.
The factory to use when invoking the in to avoid deadlocks when the main thread is required by the .
Gets a value indicating whether the action has executed completely, regardless of whether it threw an exception.
Gets a value indicating whether the action has executed completely without throwing an exception.
Executes the action given in the constructor if it has not yet been executed,
or waits for it to complete if in progress from a prior call.
Any exception thrown by the action is rethrown here.
Executes the action given in the constructor if it has not yet been executed,
or waits for it to complete if in progress from a prior call.
A task that tracks completion of the action.Any exception thrown by the action is rethrown here.
A thread-safe, lazily and asynchronously evaluated value factory.
The type of value generated by the value factory.
This class does not itself carry any resources needful of disposing.
But the value factory may produce a value that needs to be disposed of,
which is why this class carries a method but does not implement .
The value set to the field
while the value factory is executing.
A value set on the field when this object is disposed.
The object to lock to provide thread-safety.
The unique instance identifier.
The function to invoke to produce the task.
The async pump to Join on calls to .
The result of the value factory.
A joinable task whose result is the value to be cached.
Initializes a new instance of the class.
The async function that produces the value. To be invoked at most once.
The factory to use when invoking the value factory in to avoid deadlocks when the main thread is required by the value factory.
Gets a value indicating whether the value factory has been invoked.
This returns after a call to .
Gets a value indicating whether the value factory has been invoked and has run to completion.
This returns after a call to .
Gets a value indicating whether has already been called.
Gets the task that produces or has produced the value.
A task whose result is the lazily constructed value.
Thrown when the value factory calls on this instance.
Thrown after is called.
Gets the task that produces or has produced the value.
A token whose cancellation indicates that the caller no longer is interested in the result.
Note that this will not cancel the value factory (since other callers may exist).
But this token will result in an expediant cancellation of the returned Task,
and a dis-joining of any that may have occurred as a result of this call.
A task whose result is the lazily constructed value.
Thrown when the value factory calls on this instance.
Thrown after is called.
Gets the lazily computed value.
The lazily constructed value.
Thrown when the value factory calls on this instance.
Gets the lazily computed value.
A token whose cancellation indicates that the caller no longer is interested in the result.
Note that this will not cancel the value factory (since other callers may exist).
But when this token is canceled, the caller will experience an
immediately and a dis-joining of any that may have occurred as a result of this call.
The lazily constructed value.
Thrown when the value factory calls on this instance.
Thrown when is canceled before the value is computed.
Marks the code that follows as irrelevant to the receiving value factory.
A value to dispose of to restore relevance into the value factory.In some cases asynchronous work may be spun off inside a value factory.
When the value factory does not require this work to finish before the value factory can complete,
it can be useful to use this method to mark that code as irrelevant to the value factory.
In particular, this can be necessary when the spun off task may actually include code that may itself
await the completion of the value factory itself.
Such a situation would lead to an being thrown from
if the value factory has not completed already,
which can introduce non-determinstic failures in the program.A using block around the spun off code can help your program achieve reliable behavior, as shown below. numberOfApples;
public MyClass() {
this.numberOfApples = new AsyncLazy(async delegate {
// We have some fire-and-forget code to run.
// This is *not* relevant to the value factory, which is allowed to complete without waiting for this code to finish.
using (this.numberOfApples.SuppressRelevance()) {
this.FireOffNotificationsAsync();
}
// This code is relevant to the value factory, and must complete before the value factory can complete.
return await this.CountNumberOfApplesAsync();
});
}
public event EventHandler? ApplesCountingHasBegun;
public async Task GetApplesCountAsync(CancellationToken cancellationToken) {
return await this.numberOfApples.GetValueAsync(cancellationToken);
}
private async Task CountNumberOfApplesAsync() {
await Task.Delay(1000);
return 5;
}
private async Task FireOffNotificationsAsync() {
// This may call to 3rd party code, which may happen to call back into GetApplesCountAsync (and thus into our AsyncLazy instance),
// but such calls should *not* be interpreted as value factory reentrancy. They should just wait for the value factory to finish.
// We accomplish this by suppressing relevance of the value factory while this code runs (see the caller of this method above).
this.ApplesCountingHasBegun?.Invoke(this, EventArgs.Empty);
}
}
]]>If the was created with a ,
this method also calls on the
associated with that factory.
Disposes of the lazily-initialized value if disposable, and causes all subsequent attempts to obtain the value to fail.
This call will block on disposal (which may include construction of the value itself if it has already started but not yet finished) if it is the first call to dispose of the value.Calling this method will put this object into a disposed state where future calls to obtain the value will throw .If the value has already been produced and implements or , it will be disposed of.
If the value factory has already started but has not yet completed, its value will be disposed of when the value factory completes.If prior calls to obtain the value are in flight when this method is called, those calls may complete and their callers may obtain the value, although
may have been or will soon be called on the value, leading those users to experience a .Note all conditions based on the value implementing or is based on the actual value, rather than the type argument.
This means that although may be IFoo (which does not implement ), the concrete type that implements IFoo may implement
and thus be treated as a disposable object as described above.
Disposes of the lazily-initialized value if disposable, and causes all subsequent attempts to obtain the value to fail.
A task that completes when the value has been disposed of, or immediately if the value has already been disposed of or has been scheduled for disposal by a prior call.
Calling this method will put this object into a disposed state where future calls to obtain the value will throw .If the value has already been produced and implements , , or it will be disposed of.
If the value factory has already started but has not yet completed, its value will be disposed of when the value factory completes.If prior calls to obtain the value are in flight when this method is called, those calls may complete and their callers may obtain the value, although
may have been or will soon be called on the value, leading those users to experience a .Note all conditions based on the value implementing or is based on the actual value, rather than the type argument.
This means that although may be IFoo (which does not implement ), the concrete type that implements IFoo may implement
and thus be treated as a disposable object as described above.
Renders a string describing an uncreated value, or the string representation of the created value.
A structure that hides relevance of a block of code from a particular and the it was created with.
Initializes a new instance of the struct.
The instance that created this value.
Reverts the async local and thread static values to their original values.
Stores references such that they are available for retrieval
in the same call context.
The type of value to store.
The framework version specific instance of AsyncLocal to use.
Initializes a new instance of the class.
Gets or sets the value to associate with the current CallContext.
A flavor of that can be asynchronously awaited on.
Whether the task completion source should allow executing continuations synchronously.
The object to lock when accessing fields.
The source of the task to return from .
This should not need the volatile modifier because it is
always accessed within a lock.
A flag indicating whether the event is signaled.
When this is set to true, it's possible that
.Task.IsCompleted is still false
if the completion has been scheduled asynchronously.
Thus, this field should be the definitive answer as to whether
the event is signaled because it is synchronously updated.
This should not need the volatile modifier because it is
always accessed within a lock.
Initializes a new instance of the class.
A value indicating whether the event should be initially signaled.
A value indicating whether to allow callers' continuations to execute
on the thread that calls before the call returns.
callers should not hold private locks if this value is to avoid deadlocks.
When , the task returned from may not have fully transitioned to
its completed state by the time returns to its caller.
Gets a value indicating whether the event is currently in a signaled state.
Returns a task that will be completed when this event is set.
Returns a task that will be completed when this event is set.
A cancellation token.
A task that completes when the event is set, or cancels with the .
Sets this event to unblock callers of .
A task that completes when the signal has been set.
On .NET versions prior to 4.6:
This method may return before the signal set has propagated (so may return for a bit more if called immediately).
The returned task completes when the signal has definitely been set.
On .NET 4.6 and later:
This method is not asynchronous. The returned Task is always completed.
Sets this event to unblock callers of .
Resets this event to a state that will block callers of .
Sets and immediately resets this event, allowing all current waiters to unblock.
A task that completes when the signal has been set.
On .NET versions prior to 4.6:
This method may return before the signal set has propagated (so may return for a bit more if called immediately).
The returned task completes when the signal has definitely been set.
On .NET 4.6 and later:
This method is not asynchronous. The returned Task is always completed.
Sets and immediately resets this event, allowing all current waiters to unblock.
Gets an awaiter that completes when this event is signaled.
Creates a new TaskCompletionSource to represent an unset event.
A thread-safe, asynchronously dequeuable queue.
The type of values kept by the queue.
The source of the task returned by . Lazily constructed.
Volatile to allow the check-lock-check pattern in to be reliable,
in the event that within the lock, one thread initializes the value and assigns the field
and the weak memory model allows the assignment prior to the initialization. Another thread
outside the lock might observe the non-null field and start accessing the Task property
before it is actually initialized. Volatile prevents CPU reordering of commands around
the assignment (or read) of this field.
The internal queue of elements. Lazily constructed.
The internal queue of waiters. Lazily constructed.
A value indicating whether has been called.
A flag indicating whether the has been invoked.
Initializes a new instance of the class.
Gets a value indicating whether the queue is currently empty.
Gets the number of elements currently in the queue.
Gets a value indicating whether the queue has completed.
This is arguably redundant with .IsCompleted, but this property
won't cause the lazy instantiation of the Task that may if there
is no other reason for the Task to exist.
Gets a task that transitions to a completed state when is called.
Gets the synchronization object used by this queue.
Gets the initial capacity for the queue.
Signals that no further elements will be enqueued.
Adds an element to the tail of the queue.
The value to add.
Adds an element to the tail of the queue if it has not yet completed.
The value to add.
if the value was added to the queue; if the queue is already completed.
Gets the value at the head of the queue without removing it from the queue, if it is non-empty.
Receives the value at the head of the queue; or the default value for the element type if the queue is empty.
if the queue was non-empty; otherwise.
Gets the value at the head of the queue without removing it from the queue.
Thrown if the queue is empty.
Gets a task whose result is the element at the head of the queue.
A token whose cancellation signals lost interest in the item.
Cancelling this token does *not* guarantee that the task will be canceled
before it is assigned a resulting element from the head of the queue.
It is the responsibility of the caller to ensure after cancellation that
either the task is canceled, or it has a result which the caller is responsible
for then handling.
A task whose result is the head element.
Thrown when this instance has an empty queue and has been called.
Also thrown when is canceled before a work item can be dequeued.
Immediately dequeues the element from the head of the queue if one is available,
otherwise returns without an element.
Receives the element from the head of the queue; or default(T) if the queue is empty.
if an element was dequeued; if the queue was empty.
Returns a copy of this queue as an array.
Immediately dequeues the element from the head of the queue if one is available
that satisfies the specified check;
otherwise returns without an element.
The test on the head element that must succeed to dequeue.
Receives the element from the head of the queue; or default(T) if the queue is empty.
if an element was dequeued; if the queue was empty.
Invoked when a value is enqueued.
The enqueued value.
if the item will skip the queue because a dequeuer was already waiting for an item;
if the item was actually added to the queue.
Invoked when a value is dequeued.
The dequeued value.
Invoked when the queue is completed.
Immediately dequeues the element from the head of the queue if one is available,
otherwise returns without an element.
The test on the head element that must succeed to dequeue.
Receives the element from the head of the queue; or default(T) if the queue is empty.
if an element was dequeued; if the queue was empty.
Transitions this queue to a completed state if signaled and the queue is empty.
Clears as many canceled dequeuers as we can from the head of the waiting queue.
A non-blocking lock that allows concurrent access, exclusive access, or concurrent with upgradeability to exclusive access.
We have to use a custom awaitable rather than simply returning Task{LockReleaser} because
we have to set CallContext data in the context of the person receiving the lock,
which requires that we get to execute code at the start of the continuation (whether we yield or not).
Considering this class to be a state machine, the states are:
READERS
| IDLE | <-----> UPGRADEABLE READER + READERS -----> UPGRADED WRITER --\
| NO LOCKS | ^ |
| | |--- RE-ENTER CONCURRENCY PREP <--/
| | <-----> WRITER
-------------
]]>
Gets a which, when applied,
suppresses any message pump that may run during synchronous blocks
of the calling thread.
The default implementation of this property is effective
in builds of this assembly that target the .NET Framework.
But on builds that target the portable profile, it should be
overridden to provide an effective platform-specific solution.
Contributes data for a hang report.
The hang report contribution. Null values should be ignored.
Contributes data for a hang report.
The hang report contribution. Null values should be ignored.
Appends details of a given collection of awaiters to the hang report.
A time delay to check whether pending writer lock and reader locks forms a deadlock.
The default SynchronizationContext to schedule work after issuing a lock.
The object to acquire a Monitor-style lock on for all field access on this instance.
A JoinableTaskContext used to resolve dependencies between read locks to lead into deadlocks when there is a pending write lock.
A CallContext-local reference to the Awaiter that is on the top of the stack (most recently acquired).
The set of read locks that are issued and active.
Many readers are allowed concurrently. Also, readers may re-enter read locks (recursively)
each of which gets an element in this set.
The set of upgradeable read locks that are issued and active.
Although only one upgradeable read lock can be held at a time, this set may have more
than one element because that one lock holder may enter the lock it already possesses
multiple times.
The set of write locks that are issued and active.
Although only one write lock can be held at a time, this set may have more
than one element because that one lock holder may enter the lock it already possesses
multiple times.
Although this lock is mutually exclusive, there *may* be elements in the
set if the write lock was upgraded from a reader.
Also note that some elements in this may themselves be upgradeable readers if they have
the flag.
A queue of readers waiting to obtain the concurrent read lock.
A queue of upgradeable readers waiting to obtain a lock.
A queue of writers waiting to obtain an exclusive lock.
The source of the task, which transitions to completed after
the method is called and all issued locks have been released.
The queue of callbacks to invoke when the currently held write lock is totally released.
If the write lock is released to an upgradeable read lock, these callbacks are fired synchronously
with respect to the writer who is releasing the lock. Otherwise, the callbacks are invoked
asynchronously with respect to the releasing thread.
A helper class to produce ETW trace events.
A value indicating whether extra resources should be spent to collect diagnostic information
that may be useful in deadlock investigations.
A flag indicating whether we're currently running code to prepare for re-entering concurrency mode
after releasing an exclusive lock. The Awaiter being released is the non-null value.
A flag indicating that the method has been called, indicating that no
new top-level lock requests should be serviced.
A timer to recheck potential deadlock caused by pending writer locks.
Initializes a new instance of the class.
Initializes a new instance of the class.
to spend additional resources capturing diagnostic details that can be used
to analyze deadlocks or other issues.
Initializes a new instance of the class.
A JoinableTaskContext to help resolve deadlocks caused by interdependency between top read lock tasks when there is a pending write lock blocking one of them.
to spend additional resources capturing diagnostic details that can be used
to analyze deadlocks or other issues.
Flags that modify default lock behavior.
The default behavior applies.
Causes an upgradeable reader to remain in an upgraded-write state once upgraded,
even after the nested write lock has been released.
This is useful when you have a batch of possible write operations to apply, which
may or may not actually apply in the end, but if any of them change anything,
all of their changes should be seen atomically (within a single write lock).
This approach is preferable to simply acquiring a write lock around the batch of
potential changes because it doesn't defeat concurrent readers until it knows there
is a change to actually make.
An enumeration of the kinds of locks supported by this class.
A lock that supports concurrently executing threads that hold this same lock type.
Holders of this lock may not obtain a lock without first
releasing all their locks.
A lock that may run concurrently with standard readers, but is exclusive of any other
upgradeable readers. Holders of this lock are allowed to obtain a write lock while
holding this lock to guarantee continuity of state between what they read and what they write.
A mutually exclusive lock.
Gets a value indicating whether any kind of lock is held by the caller and can
be immediately used given the caller's context.
Gets a value indicating whether any kind of lock is held by the caller without regard
to the lock compatibility of the caller's context.
Gets a value indicating whether the caller holds a read lock.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a value indicating whether a read lock is held by the caller without regard
to the lock compatibility of the caller's context.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a value indicating whether the caller holds an upgradeable read lock.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a value indicating whether an upgradeable read lock is held by the caller without regard
to the lock compatibility of the caller's context.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a value indicating whether the caller holds a write lock.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a value indicating whether a write lock is held by the caller without regard
to the lock compatibility of the caller's context.
This property returns if any other lock type is held, unless
within that alternate lock type this lock is also nested.
Gets a task whose completion signals that this lock will no longer issue locks.
This task only transitions to a complete state after a call to .
Gets the object used to synchronize access to this instance's fields.
Gets the lock held by the caller's execution context.
Gets or sets a value indicating whether additional resources should be spent to collect
information that would be useful in diagnosing deadlocks, etc.
Gets a time delay to check whether pending writer lock and reader locks forms a deadlock.
Gets a value indicating whether the current thread is allowed to
hold an active lock.
The default implementation of this property returns
when the calling thread is NOT an STA thread.
This property may be overridden to return
on threads that may compromise the integrity of the lock.
Gets a value indicating whether the current SynchronizationContext is one that is not supported
by this lock.
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains an upgradeable read lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available.
Modifications to normal lock behavior.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available.
Modifications to normal lock behavior.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Prevents use or visibility of the caller's lock(s) until the returned value is disposed.
The value to dispose to restore lock visibility.
This can be used by a write lock holder that is about to fork execution to avoid
two threads simultaneously believing they hold the exclusive write lock.
The lock should be hidden just before kicking off the work and can be restored immediately
after kicking off the work.
Causes new top-level lock requests to be rejected and the task to transition
to a completed state after any issued locks have been released.
Registers a callback to be invoked when the write lock held by the caller is
about to be ultimately released (outermost write lock).
The asynchronous delegate to invoke.
Access to the write lock is provided throughout the asynchronous invocation.
This supports some scenarios VC++ has where change event handlers need to inspect changes,
or follow up with other changes to respond to earlier changes, at the conclusion of the lock.
This method is safe to call from within a previously registered callback, in which case the
registered callback will run when previously registered callbacks have completed execution.
If the write lock is released to an upgradeable read lock, these callbacks are fired synchronously
with respect to the writer who is releasing the lock. Otherwise, the callbacks are invoked
asynchronously with respect to the releasing thread.
Disposes managed and unmanaged resources held by this instance.
if was called; if the object is being finalized.
Checks whether the aggregated flags from all locks in the lock stack satisfy the specified flag(s).
The flag(s) that must be specified for a result.
The head of the lock stack to consider.
if all the specified flags are found somewhere in the lock stack; otherwise.
Returns the aggregate of the lock flags for all nested locks.
This is not redundant with because that returns fast
once the presence of certain flag(s) is determined, whereas this will aggregate all flags,
some of which may be defined by derived types.
Fired when any lock is being released.
if the last write lock that the caller holds is being released; otherwise.
The lock being released.
A task whose completion signals the conclusion of the asynchronous operation.
Fired when the last write lock is about to be released.
A task whose completion signals the conclusion of the asynchronous operation.
Get the task scheduler to execute the continuation when the lock is acquired.
AsyncReaderWriterLock uses a special to handle exclusive locks, and will ignore task scheduler provided, so this is only used in a read lock scenario.
This method is called within the execution context to wait the read lock, so it can pick up based on the current execution context.
Note: the task scheduler is only used, when the lock is issued later. If the lock is issued immediately when returns true, it will be ignored.
A task scheduler to schedule the continuation task when a lock is issued.
Invoked after an exclusive lock is released but before anyone has a chance to enter the lock.
This method is called while holding a private lock in order to block future lock consumers till this method is finished.
Invoked when a top-level upgradeable read lock is released, leaving no remaining (write) lock.
Invoked when the lock detects an internal error or illegal usage pattern that
indicates a serious flaw that should be immediately reported to the application
and/or bring down the process to avoid hangs or data corruption.
The exception that captures the details of the failure.
An exception that may be returned by some implementations of tis method for he caller to rethrow.
Invoked when the lock detects an internal error or illegal usage pattern that
indicates a serious flaw that should be immediately reported to the application
and/or bring down the process to avoid hangs or data corruption.
The message to use for the exception.
An exception that may be returned by some implementations of tis method for he caller to rethrow.
Checks whether the specified lock has any active nested locks.
Throws an exception if called on an STA thread.
Gets a value indicating whether the caller's thread apartment model and SynchronizationContext
is compatible with a lock.
Transitions the task to a completed state
if appropriate.
Detects which lock types the given lock holder has (including all nested locks).
The most nested lock to be considered.
Receives a value indicating whether a read lock is held.
Receives a value indicating whether an upgradeable read lock is held.
Receives a value indicating whether a write lock is held.
Gets a value indicating whether all issued locks are merely the top-level lock or nesting locks of the specified lock.
The most nested lock.
if all issued locks are the specified lock or nesting locks of it.
Gets a value indicating whether the specified lock is, or is a nested lock of, a given type.
The kind of lock being queried for.
The (possibly nested) lock.
if the lock holder (also) holds the specified kind of lock.
Checks whether the specified lock is an upgradeable read lock, with a flag,
which has actually be upgraded.
The lock to test.
if the test succeeds; otherwise.
Checks whether the caller's held locks (or the specified lock stack) includes an active lock of the specified type.
Always when called on an STA thread.
The type of lock to check for.
The most nested lock of the caller, or null to look up the caller's lock in the CallContext.
to throw an exception if the caller has an exclusive lock but not an associated SynchronizationContext.
to return true when a lock is held but unusable because of the context of the caller.
if the caller holds active locks of the given type; otherwise.
Checks whether a given lock is active.
Always when called on an STA thread.
The lock to check.
if the return value will always be if called on an STA thread.
to throw an exception if the caller has an exclusive lock but not an associated SynchronizationContext.
if the lock is currently issued and the caller is not on an STA thread.
Checks whether the specified awaiter's lock type has an associated SynchronizationContext if one is applicable.
The awaiter whose lock should be considered.
Immediately issues a lock to the specified awaiter if it is available.
The awaiter to issue a lock to.
A value indicating whether this lock was previously queued. if this is a new just received request.
The value is used to determine whether to reject it if has already been called and this
is a new top-level request.
Normally, new reader locks are no longer issued when there is a pending writer lock to allow existing reader lock to complete.
However, that can lead deadlocks, when tasks with issued lock depending on tasks requiring new read locks to complete.
When it is true, new reader locks will be issued even when there is a pending writer lock.
A value indicating whether the lock was issued.
Finds the upgradeable reader with flag that is nearest
to the top-level lock request held by the given lock holder.
The awaiter to start the search down the stack from.
The least nested upgradeable reader lock with sticky write flag; or if none was found.
Gets the set of locks of a given kind.
The kind of lock.
A set of locks.
Gets the queue for a lock with a given type.
The kind of lock.
A queue.
Walks the nested lock stack until it finds an active one.
The most nested lock to consider. May be null.
The first active lock encountered, or if none.
Issues a lock to the specified awaiter and executes its continuation.
The awaiter should have already been dequeued.
The awaiter to issue a lock to and execute.
Releases the lock held by the specified awaiter.
The awaiter holding an active lock.
A value indicating whether the lock consumer ended up not executing any work.
A task that should complete before the releasing thread accesses any resource protected by
a lock wrapping the lock being released.
The task will always be complete if is .
This method guarantees that the lock is effectively released from the caller, and the
can be safely recycled, before the synchronous portion of this method completes.
Schedules work on a background thread that will prepare protected resource(s) for concurrent access.
Checks whether the specified lock has any active nested locks.
Called at the conclusion of releasing an exclusive lock to complete the transition.
The awaiter being released.
A flag indicating whether the lock being released was an upgraded read lock with the sticky write flag set.
to scan the entire queue for pending lock requests that might qualify; used when qualifying locks were delayed for some reason besides lock contention.
Issues locks to one or more queued lock requests and executes their continuations
based on lock availability and policy-based prioritization (writer-friendly, etc.)
to scan the entire queue for pending lock requests that might qualify; used when qualifying locks were delayed for some reason besides lock contention.
if any locks were issued; otherwise.
Invokes the final write lock release callbacks, if appropriate.
A task representing the work of sequentially invoking the callbacks.
Dequeues a single write lock release callback if available.
Receives the callback to invoke, if any.
A value indicating whether a callback was available to invoke.
Stores the specified lock in the CallContext dictionary.
The awaiter that tracks the lock to grant to the caller.
Issues locks to all queued reader lock requests if there are no issued write locks.
to scan the entire queue for pending lock requests that might qualify; used when qualifying locks were delayed for some reason besides lock contention.
A value indicating whether any readers were issued locks.
Issues a lock to the next queued upgradeable reader, if no upgradeable read or write locks are currently issued.
to scan the entire queue for pending lock requests that might qualify; used when qualifying locks were delayed for some reason besides lock contention.
A value indicating whether any upgradeable readers were issued locks.
Issues a lock to the next queued writer, if no other locks are currently issued
or the last contending read lock was removed allowing a waiting upgradeable reader to upgrade.
to scan the entire queue for pending lock requests that might qualify; used when qualifying locks were delayed for some reason besides lock contention.
A value indicating whether a writer was issued a lock.
Scans a lock awaiter queue for any that can be issued locks now.
The queue to scan.
to break out immediately after issuing the first lock.
if any lock was issued; otherwise.
Issues a lock to a lock waiter and execute its code if the lock is immediately available, otherwise
queues the lock request.
The lock request.
Executes the lock receiver or releases the lock because the request for it was canceled before it was issued.
The awaiter.
A value indicating whether the specified is expected to still be in the queue (and should be removed).
A value indicating whether a continuation delegate was actually invoked.
An awaitable that is returned from asynchronous lock requests.
The awaiter to return from the method.
Initializes a new instance of the struct.
The lock class that created this instance.
The type of lock being requested.
Any flags applied to the lock request.
The cancellation token.
to throw an exception if the caller has an exclusive lock but not an associated SynchronizationContext.
Gets the awaiter value.
A value whose disposal releases a held lock.
The awaiter who manages the lifetime of a lock.
Initializes a new instance of the struct.
The awaiter.
Releases the lock.
Releases the lock.
Asynchronously releases the lock. Dispose should still be called after this.
A task that should complete before the releasing thread accesses any resource protected by
a lock wrapping the lock being released.
Rather than calling this method explicitly, use the C# 8 "await using" syntax instead.
A value whose disposal restores visibility of any locks held by the caller.
The locking class.
The awaiter most recently acquired by the caller before hiding locks.
Initializes a new instance of the struct.
The lock class.
Restores visibility of hidden locks.
A "public" representation of a specific lock.
The awaiter this lock handle wraps.
Initializes a new instance of the struct.
Gets a value indicating whether this handle is to a lock which was actually acquired.
Gets a value indicating whether this lock is still active.
Gets a value indicating whether this lock represents a read lock.
Gets a value indicating whether this lock represents an upgradeable read lock.
Gets a value indicating whether this lock represents a write lock.
Gets a value indicating whether this lock is an active read lock or is nested by one.
Gets a value indicating whether this lock is an active upgradeable read lock or is nested by one.
Gets a value indicating whether this lock is an active write lock or is nested by one.
Gets the flags that were passed into this lock.
Gets or sets some object associated to this specific lock.
Gets the lock within which this lock was acquired.
Gets the wrapped awaiter.
Manages asynchronous access to a lock.
A singleton delegate for use in cancellation token registration to avoid memory allocations for delegates each time.
The instance of the lock class to which this awaiter is affiliated.
The type of lock requested.
The "parent" lock (i.e. the lock within which this lock is nested) if any.
The cancellation token that would terminate waiting for a lock that is not yet available.
The flags applied to this lock.
The stack trace of the caller originally requesting the lock.
This field is initialized only when is constructed with
the captureDiagnostics parameter set to .
The cancellation token event that should be disposed of to free memory when we no longer need to receive cancellation notifications.
Any exception to throw back to the lock requestor.
The continuation to execute when the lock is available.
The continuation we invoked to an issued lock.
We retain this value simply so that in hang reports we can identify the method we issued the lock to.
The TaskScheduler to invoke the continuation.
The task from a prior call to , if any.
The synchronization context applied to folks who hold the lock.
An arbitrary object that may be set by a derived type of the containing lock class.
Initializes a new instance of the class.
The lock class creating this instance.
The type of lock being requested.
The flags to apply to the lock.
The cancellation token.
Gets a value indicating whether the lock has been issued.
Gets the lock instance that owns this awaiter.
Gets the stack trace of the requestor of this lock.
Used for diagnostic purposes only.
Gets the delegate to invoke (or that was invoked) when the lock is/was issued, if available.
FOR DIAGNOSTIC PURPOSES ONLY.
Gets the lock that the caller held before requesting this lock.
Gets or sets an arbitrary object that may be set by a derived type of the containing lock class.
Gets the cancellation token.
Gets the kind of lock being requested.
Gets the flags applied to this lock.
Gets a value indicating whether the lock has already been released.
Gets the ambient JoinableTask when the lock is requested. This is used to resolve deadlock caused by issued read lock depending on new read lock requests blocked by pending write locks.
Gets a value indicating whether the lock is active.
iff the lock has bee issued, has not yet been released, and the caller is on an MTA thread.
Sets the delegate to execute when the lock is available.
The delegate.
Sets the delegate to execute when the lock is available
without flowing ExecutionContext.
The delegate.
Applies the issued lock to the caller and returns the value used to release the lock.
The value to dispose of to release the lock.
Releases the lock and recycles this instance.
Executes the code that requires the lock.
if the continuation was (asynchronously) invoked; if there was no continuation available to invoke.
Specifies the exception to throw from .
Responds to lock request cancellation.
The instance being canceled.
Get the correct SynchronizationContext to execute code executing within the lock.
Note: we need get the NonConcurrentSynchronizationContext from the nesting exclusive lock, because the child lock is essentially under the same context.
When we don't have a valid nesting lock, we will create a new NonConcurrentSynchronizationContext for an exclusive lock. For read lock, we don't put it within a NonConcurrentSynchronizationContext,
we set it to DefaultSynchronizationContext to mark we have computed it. The result is cached.
Sets the delegate to execute when the lock is available.
The delegate.
A value indicating whether to flow ExecutionContext.
The managed thread ID of the thread that has entered the semaphore.
No reason to lock around access to this field because it is only ever set to
or compared against the current thread, so the activity of other threads is irrelevant.
Gets a value indicating whether the current thread holds the semaphore.
Executes the specified delegate.
We use async void instead of async Task because the caller will never
use the result, and this way the compiler doesn't have to create the Task object.
A non-blocking lock that allows concurrent access, exclusive access, or concurrent with upgradeability to exclusive access,
making special allowances for resources that must be prepared for concurrent or exclusive access.
The type of the moniker that identifies a resource.The type of resource issued for access by this lock.
A private nested class we use to isolate some of the behavior.
Initializes a new instance of the class.
Initializes a new instance of the class.
to spend additional resources capturing diagnostic details that can be used
to analyze deadlocks or other issues.
Initializes a new instance of the class.
A JoinableTaskContext to help resolve dead locks caused by interdependency between top read lock tasks when there is a pending write lock blocking one of them.
to spend additional resources capturing diagnostic details that can be used
to analyze deadlocks or other issues.
Flags that modify default lock behavior.
The default behavior applies.
Causes an upgradeable reader to remain in an upgraded-write state once upgraded,
even after the nested write lock has been released.
This is useful when you have a batch of possible write operations to apply, which
may or may not actually apply in the end, but if any of them change anything,
all of their changes should be seen atomically (within a single write lock).
This approach is preferable to simply acquiring a write lock around the batch of
potential changes because it doesn't defeat concurrent readers until it knows there
is a change to actually make.
Skips a step to make sure that the resource is initially prepared when retrieved using GetResourceAsync.
This flag is dormant for non-write locks. But if present on an upgradeable read lock,
this flag will activate for a nested write lock.
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available.
Modifications to normal lock behavior.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains an upgradeable read lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available.
Modifications to normal lock behavior.
A token whose cancellation indicates lost interest in obtaining the lock.
A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
a canceled token will cause the code that is waiting for the lock to resume with an .
An awaitable object whose result is the lock releaser.
Retrieves the resource with the specified moniker.
The identifier for the desired resource.
A token whose cancellation indicates lost interest in obtaining the resource.
A task whose result is the desired resource.
Marks a resource as having been retrieved under a lock.
Marks any loaded resources as having been retrieved under a lock if they
satisfy some predicate.
A function that returns if the provided resource should be considered retrieved.
The state object to pass as a second parameter to .
if the delegate returned on any of the invocations.
Sets all the resources to be considered in an unknown state.
Returns the aggregate of the lock flags for all nested locks.
Gets a task scheduler to prepare a resource for concurrent access.
The resource to prepare.
A .
Prepares a resource for concurrent access.
The resource to prepare.
The token whose cancellation signals lost interest in the resource.
A task whose completion signals the resource has been prepared.
This is invoked on a resource when it is initially requested for concurrent access,
for both transitions from no access and exclusive access.
Prepares a resource for access by one thread.
The resource to prepare.
The aggregate of all flags from the active and nesting locks.
The token whose cancellation signals lost interest in the resource.
A task whose completion signals the resource has been prepared.
This is invoked on a resource when it is initially access for exclusive access,
but only when transitioning from no access -- it is not invoked when transitioning
from concurrent access to exclusive access.
Invoked after an exclusive lock is released but before anyone has a chance to enter the lock.
This method is called while holding a private lock in order to block future lock consumers till this method is finished.
Invoked when a top-level upgradeable read lock is released, leaving no remaining (write) lock.
An awaitable that is returned from asynchronous lock requests.
The underlying lock awaitable.
The helper class.
Initializes a new instance of the struct.
The underlying lock awaitable.
The helper class.
Gets the awaiter value.
Manages asynchronous access to a lock.
The underlying lock awaiter.
The helper class.
Initializes a new instance of the struct.
The underlying lock awaiter.
The helper class.
Gets a value indicating whether the lock has been issued.
Sets the delegate to execute when the lock is available.
The delegate.
Sets the delegate to execute when the lock is available.
The delegate.
Applies the issued lock to the caller and returns the value used to release the lock.
The value to dispose of to release the lock.
A value whose disposal releases a held lock.
The underlying lock releaser.
The helper class.
Initializes a new instance of the struct.
The underlying lock releaser.
The helper class.
Gets the underlying lock releaser.
Gets the lock protected resource.
The identifier for the protected resource.
A token whose cancellation signals lost interest in the protected resource.
A task whose result is the resource.
Releases the lock.
Releases the lock.
Asynchronously releases the lock. Dispose should still be called after this.
Rather than calling this method explicitly, use the C# 8 "await using" syntax instead.
A helper class to isolate some specific functionality in this outer class.
The owning lock instance.
A reusable delegate that invokes the method.
A reusable delegate that invokes the method.
A reusable delegate that invokes the method.
A reusable delegate that invokes the method.
A reusable delegate that invokes the method.
A reusable delegate that invokes the method.
A collection of all the resources requested within the outermost upgradeable read lock.
A map of resources to the status of tasks that most recently began evaluating them.
Initializes a new instance of the class.
The owning lock instance.
Describes the states a resource can be in.
The resource is neither prepared for concurrent nor exclusive access.
The resource is prepared for concurrent access.
The resource is prepared for exclusive access.
Marks a resource as having been retrieved under a lock.
Marks any loaded resources as having been retrieved under a lock if they
satisfy some predicate.
A function that returns if the provided resource should be considered retrieved.
The state object to pass as a second parameter to .
if the delegate returned on any of the invocations.
Ensures that all resources are marked as unprepared so at next request they are prepared again.
Invoked when a top-level upgradeable read lock is released, leaving no remaining (write) lock.
Retrieves the resource with the specified moniker.
The identifier for the desired resource.
The token whose cancellation signals lost interest in this resource.
A task whose result is the desired resource.
Sets all the resources to be considered in an unknown state. Any subsequent access (exclusive or concurrent) will prepare the resource.
Sets the specified resource to be considered in an unknown state. Any subsequent access (exclusive or concurrent) will prepare the resource.
Sets the specified resources to be considered in an unknown state. Any subsequent access (exclusive or concurrent) will prepare the resource.
Prepares the specified resource for access by a lock holder.
The resource to prepare.
The token whose cancellation signals lost interest in this resource.
Force preparation of the resource for concurrent access, even if an exclusive lock is currently held.
A task that is completed when preparation has completed.
Reserves a read lock from a previously held lock.
The releaser for the read lock.Thrown if no lock is held by the caller.
Tracks a task that prepares a resource for either concurrent or exclusive use.
Initializes a new instance of the class.
Gets the state the resource will be in when inner task has completed.
Creates a task to prepare the source and returns it with .
A callback method to create the preparation task.
The final resource state when the preparation is done.
A task scheduler for continuation.
A cancellation token to abort the preparation task.
The preparation task and its status to be used to join more waiting tasks later.
Try to join an existing preparation task.
The new waiting task to be completed when the resource preparation is done.
A task scheduler for continuation.
A cancellation token to abandon the new waiting task.
True if it joins successfully, it return false, if the current task has been cancelled.
An asynchronous like class with more convenient release syntax.
This semaphore guarantees FIFO ordering.
This object does *not* need to be disposed of, as it does not hold unmanaged resources.
Disposing this object has no effect on current users of the semaphore, and they are allowed to release their hold on the semaphore without exception.
An is thrown back at anyone asking to or waiting to enter the semaphore after is called.
A task that is faulted with an .
A task that is canceled without a specific token.
A task to return for any uncontested request for the lock.
The sync object to lock on for mutable field access.
A queue of operations waiting to enter the semaphore.
A pool of recycled nodes.
A value indicating whether this instance has been disposed.
Initializes a new instance of the class.
The initial number of requests for the semaphore that can be granted concurrently.
Gets the number of openings that remain in the semaphore.
Requests access to the lock.
A token whose cancellation signals lost interest in the lock.
A task whose result is a releaser that should be disposed to release the lock.
This task may be canceled if is signaled.
Thrown when is canceled before semaphore access is granted.Thrown when this semaphore is disposed before semaphore access is granted.
Requests access to the lock.
A timeout for waiting for the lock.
A token whose cancellation signals lost interest in the lock.
A task whose result is a releaser that should be disposed to release the lock.
This task may be canceled if is signaled or expires.
Thrown when is canceled or the expires before semaphore access is granted.Thrown when this semaphore is disposed before semaphore access is granted.
Requests access to the lock.
A timeout for waiting for the lock (in milliseconds).
A token whose cancellation signals lost interest in the lock.
A task whose result is a releaser that should be disposed to release the lock.Thrown when is canceled or the expires before semaphore access is granted.Thrown when this semaphore is disposed before semaphore access is granted.
Faults all pending semaphore waiters with
and rejects all subsequent attempts to enter the semaphore with the same exception.
Disposes managed and unmanaged resources held by this instance.
if was called; if the object is being finalized.
A value whose disposal triggers the release of a lock.
The lock instance to release.
Initializes a new instance of the struct.
The lock instance to release on.
Releases the lock.
Disposes of and any applicable timer.
Callers should avoid calling this method while holding the lock
since can block on completion of
which requires that same lock.
Extension methods and awaitables for .NET 4.5.
Gets an awaiter that schedules continuations on the specified scheduler.
The task scheduler used to execute continuations.
An awaitable.
Gets an awaiter that schedules continuations on the specified .
The synchronization context used to execute continuations.
An awaitable.
The awaiter that is returned will always result in yielding, even if already executing within the specified .
Gets an awaitable that schedules continuations on the specified scheduler.
The task scheduler used to execute continuations.
A value indicating whether the caller should yield even if
already executing on the desired task scheduler.
An awaitable.
Provides await functionality for ordinary s.
The handle to wait on.
The awaiter.
Returns a task that completes when the process exits and provides the exit code of that process.
The process to wait for exit.
A token whose cancellation will cause the returned Task to complete
before the process exits in a faulted state with an .
This token has no effect on the itself.
A task whose result is the of the .
Returns a Task that completes when the specified registry key changes.
The registry key to watch for changes.
to watch the keys descendent keys as well; to watch only this key without descendents.
Indicates the kinds of changes to watch for.
A token that may be canceled to release the resources from watching for changes and complete the returned Task as canceled.
A task that completes when the registry key changes, the handle is closed, or upon cancellation.
Converts a to a .
The result of .
A value indicating whether the continuation should run on the captured , if any.
An awaitable.
Gets an awaitable that schedules the continuation with a preference to executing synchronously on the callstack that completed the ,
without regard to thread ID or any that may be applied when the continuation is scheduled or when the antecedent completes.
The task to await on.
An awaitable.
If there is not enough stack space remaining on the thread that is completing the ,
the continuation may be scheduled on the threadpool.
Gets an awaitable that schedules the continuation with a preference to executing synchronously on the callstack that completed the ,
without regard to thread ID or any that may be applied when the continuation is scheduled or when the antecedent completes.
The type of value returned by the awaited .
The task to await on.
An awaitable.
If there is not enough stack space remaining on the thread that is completing the ,
the continuation may be scheduled on the threadpool.
Returns an awaitable that will throw from the property of the task if it faults.
The task to track for completion.
An awaitable that may throw .
Awaiting a with its default only throws the first exception within .
When you do not want to lose the detail of other inner exceptions, use this extension method.
Thrown when faults.
Returns a Task that completes when the specified registry key changes.
The handle to the open registry key to watch for changes.
to watch the keys descendent keys as well; to watch only this key without descendents.
Indicates the kinds of changes to watch for.
A token that may be canceled to release the resources from watching for changes and complete the returned Task as canceled.
A task that completes when the registry key changes, the handle is closed, or upon cancellation.
The result of to prepare a to be awaited while throwing with all inner exceptions.
Initializes a new instance of the struct.
Gets an awaitable that schedules continuations on the specified scheduler.
The result of to prepare a to be awaited while throwing with all inner exceptions.
Initializes a new instance of the struct.
Thrown if the task was canceled.Thrown if the task faulted.
An awaitable that executes continuations on the specified task scheduler.
The scheduler for continuations.
A value indicating whether the awaitable will always call the caller to yield.
Initializes a new instance of the struct.
The task scheduler used to execute continuations.
A value indicating whether the caller should yield even if
already executing on the desired task scheduler.
Gets an awaitable that schedules continuations on the specified scheduler.
An awaiter returned from .
The scheduler for continuations.
A value indicating whether
should always return false.
Initializes a new instance of the struct.
The scheduler for continuations.
A value indicating whether the caller should yield even if
already executing on the desired task scheduler.
Gets a value indicating whether no yield is necessary.
if the caller is already running on that TaskScheduler.
Schedules a continuation to execute using the specified task scheduler.
The delegate to invoke.
Schedules a continuation to execute using the specified task scheduler
without capturing the ExecutionContext.
The action.
Does nothing.
An awaiter returned from .
The context for continuations.
Initializes a new instance of the struct.
The context for continuations.
Gets a value indicating whether no yield is necessary.
Always returns .
Schedules a continuation to execute using the specified .
The delegate to invoke.
Schedules a continuation to execute using the specified
without capturing the .
The action.
Does nothing.
An awaitable that will always lead the calling async method to yield,
then immediately resume, possibly on the original .
A value indicating whether the continuation should run on the captured , if any.
Initializes a new instance of the struct.
A value indicating whether the continuation should run on the captured , if any.
Gets the awaiter.
The awaiter.
An awaiter that will always lead the calling async method to yield,
then immediately resume, possibly on the original .
A value indicating whether the continuation should run on the captured , if any.
Initializes a new instance of the struct.
A value indicating whether the continuation should run on the captured , if any.
Gets a value indicating whether the caller should yield.
Always false.
Schedules a continuation to execute immediately (but not synchronously).
The delegate to invoke.
Schedules a delegate for execution at the conclusion of a task's execution
without capturing the ExecutionContext.
The action.
Does nothing.
A Task awaitable that has affinity to executing callbacks synchronously on the completing callstack.
The task whose completion will execute the continuation.
Initializes a new instance of the struct.
The task whose completion will execute the continuation.
Gets the awaiter.
The awaiter.
A Task awaiter that has affinity to executing callbacks synchronously on the completing callstack.
The task whose completion will execute the continuation.
Initializes a new instance of the struct.
The task whose completion will execute the continuation.
Gets a value indicating whether the antedent has already completed.
Rethrows any exception thrown by the antecedent.
Schedules a callback to run when the antecedent task completes.
The callback to invoke.
A Task awaitable that has affinity to executing callbacks synchronously on the completing callstack.
The type of value returned by the awaited .
The task whose completion will execute the continuation.
Initializes a new instance of the struct.
The task whose completion will execute the continuation.
Gets the awaiter.
The awaiter.
A Task awaiter that has affinity to executing callbacks synchronously on the completing callstack.
The type of value returned by the awaited .
The task whose completion will execute the continuation.
Initializes a new instance of the struct.
The task whose completion will execute the continuation.
Gets a value indicating whether the antedent has already completed.
Rethrows any exception thrown by the antecedent.
Schedules a callback to run when the antecedent task completes.
The callback to invoke.
Provides a dedicated thread for requesting registry change notifications.
For versions of Windows prior to Windows 8, requesting registry change notifications
required that the thread that made the request remain alive or else the watcher would
simply signal the event and stop watching for changes.
This class provides a single, dedicated thread for requesting such notifications
so that they don't get canceled when a thread happens to exit.
The dedicated thread is released when no one is watching the registry any more.
The size of the stack allocated for a thread that expects to stay within just a few methods in depth.
The default stack size for a thread is 1MB.
The object to lock when accessing any fields.
This is also the object that is waited on by the dedicated thread,
and may be pulsed by others to wake the dedicated thread to do some work.
A queue of actions the dedicated thread should take.
The number of callers that still have an interest in the survival of the dedicated thread.
The dedicated thread will exit when this value reaches 0.
The thread that should stay alive and be dequeuing .
Executes some action on a long-lived thread.
The delegate to execute.
A task that either faults with the exception thrown by
or completes after successfully executing the delegate
with a result that should be disposed when it is safe to terminate the long-lived thread.
This thread never posts to , so it is safe
to call this method and synchronously block on its result.
Decrements the count of interested parties in the live thread,
and helps it to terminate if necessary.
Executes thread-affinitized work from a queue until both the queue is empty
and any lingering interest in the survival of the dedicated thread has been released.
This method serves as the for our dedicated thread.
Decrements the dedicated thread use counter by at most one upon disposal.
A value indicating whether this instance has already been disposed.
Release the keep alive count reserved by this instance.
Returns an object containing .
Returns an object containing .
Returns an object containing specified value.
Represents a possible shared computation task, which can be joined by multiple consumers with a cancellation token.
The overall computation is cancelled if all its consumers are cancelled.
The object to acquire a Monitor-style lock on for all field access on this instance.
A list of task completion sources which represents joined waiting requests with cancellable cancellation tokens.
When an individual cancellation token is triggered, we may allow that specific waiting task to continue, and only all of them abandon the computation then we may
cancel the inner computation.
A combined cancellation token source to cancel the inner computation task.
The number of waiting requests which are not cancelled. It is only meaningful when is true.
Whether the inner task can be cancelled. If one waiting request is not cancellable, the inner task cannot be cancelled.
Whether the cancellation of the inner task is requested. A new waiting request will not be allowed, once it is true.
Initializes a new instance of the class.
A callback to create the task.
Whether the inner task can be cancelled.
Gets the inner computation task.
Try to join the computation.
It is true for the initial task starting the computation. This must be called once right after the constructor.
Returns a task which can be waited on.
A task scheduler for continuation.
A cancellation token to abort this waiting.
It returns false, if the inner task is aborted. In which case, no way to join the existing computation.
A simple way to join if the inner task cannot be cancelled.
Whether it is the first task to start the computation.
A task scheduler for continuation.
A cancellation token to abort the waiting.
A task to complete when the computation ends.
Handles one waiting task can be cancelled.
The status of the waiting task being cancelled.
Represents the status of a single request waiting the inner task to complete.
The cancellation registration to handle the cancellation token of the request.
Initializes a new instance of the class.
The joined computation.
The cancellation token of the request.
Gets the joined computation.
Note: we set it to the state of the TaskCompletionSource. It makes it easy to trace it through the waiting task in dump files.
Gets the cancellation token of the waiting task.
Dispose this instance.
Extensions to .
Creates a new that is canceled when any of a set of other tokens are canceled.
The first token.
The second token.
A struct that contains the combined and a means to release memory when you're done using it.
Creates a new that is canceled when any of a set of other tokens are canceled.
The first token.
The additional tokens.
A struct that contains the combined and a means to release memory when you're done using it.
Provides access to a that combines multiple other tokens,
and allows convenient disposal of any applicable .
The object to dispose when this struct is disposed.
Initializes a new instance of the struct
that contains an aggregate whose source must be disposed.
The cancellation token source.
Initializes a new instance of the struct
that represents just a single, non-disposable .
The cancellation token.
Gets the combined cancellation token.
Checks whether two instances of are equal.
The left operand.
The right operand.
if they are equal; otherwise.
Checks whether two instances of are not equal.
The left operand.
The right operand.
if they are not equal; if they are equal.
Disposes the behind this combined token, if any.
A JoinableTaskFactory base class for derived types that delegate some of their work to an existing instance.
All virtual methods default to calling into the inner for its behavior,
rather than the default behavior of the base class.
This is useful because a derived-type cannot call protected methods on another instance of that type.
The inner factory that will create the tasks.
Initializes a new instance of the class.
The inner factory that will create the tasks.
Synchronously blocks the calling thread for the completion of the specified task.
The task whose completion is being waited on.
Posts a message to the specified underlying SynchronizationContext for processing when the main thread
is freely available.
The callback to invoke.
State to pass to the callback.
Raised when a joinable task has requested a transition to the main thread.
The task requesting the transition to the main thread.
This event may be raised on any thread, including the main thread.
Raised whenever a joinable task has completed a transition to the main thread.
The task whose request to transition to the main thread has completed.
A value indicating whether the transition was cancelled before it was fulfilled.
This event is usually raised on the main thread, but can be on another thread when is .
The namespace that all DGML nodes appear in.
Adds categories to a DGML node or link.
The node or link to add categories to.
The categories to add.
The same node that was passed in. To enable "fluent" syntax.
An empty struct.
This can save 4 bytes over System.Object when a type argument is required for a generic type, but entirely unused.
Gets an instance of the empty struct.
Enumerates either a single element or a list of elements.
The type of element to enumerate.
The single element to enumerate, when applicable.
The enumerator of the list.
A value indicating whether a single element or a list of them is being enumerated.
The position around the lone element being enumerated, when applicable.
Initializes a new instance of the struct.
The single value to enumerate.
Initializes a new instance of the struct.
The list of values to enumerate.
Gets the current value.
Gets the current value.
Disposes this enumerator.
Advances enumeration to the next element.
Resets this enumerator.
A contribution to an aggregate hang report.
Initializes a new instance of the class.
The content for the hang report.
The MIME type of the attached content.
The suggested filename of the content when it is attached in a report.
Initializes a new instance of the class.
The content for the hang report.
The MIME type of the attached content.
The suggested filename of the content when it is attached in a report.
Nested reports.
Gets the content of the hang report.
Gets the MIME type for the content.
Gets the suggested filename for the content.
Gets the nested hang reports, if any.
A read only collection, or .
Defines an asynchronous method to release allocated resources.
Consider implementing instead.
Performs application-defined tasks associated with freeing,
releasing, or resetting unmanaged resources asynchronously.
Provides a facility to produce reports that may be useful when analyzing hangs.
Contributes data for a hang report.
The hang report contribution. Null values should be ignored.
Represents a dependent item in the JoinableTask dependency graph, it can be either a or a .
Gets the this node belongs to.
Gets a value indicating whether we need reference count child dependent node. This is to keep the current behavior of .
Get the reference of dependent node to record dependencies.
A function is called, when this dependent node is added to be a dependency of a parent node.
A function is called, when this dependent node is removed as a dependency of a parent node.
A function is called, when a dependent child is added.
A function is called, when a dependent child is removed.
Exception which is thrown when the contract of a is violated.
Initializes a new instance of the class.
An awaiter that can be pre-created, and later immediately execute its one scheduled continuation.
The continuation that has been scheduled.
The current as of when the continuation was scheduled.
Whether has been called already.
Gets a value indicating whether an awaiting expression should yield.
Always .
Does and returns nothing.
Stores the continuation for later execution when is invoked.
The delegate to execute later.
Stores the continuation for later execution when is invoked.
The delegate to execute later.
Gets this instance. This method makes this awaiter double as its own awaitable.
This instance.
Executes the continuation immediately, on the caller's thread.
Internal helper/extension methods for this assembly's own use.
The substring that should be inserted before each async return stack frame.
When printing synchronous callstacks, .NET begins each frame with " at ".
When printing async return stack, we use this to indicate continuations.
Removes an element from the middle of a queue without disrupting the other elements.
The element to remove.
The queue to modify.
The value to remove.
If a value appears multiple times in the queue, only its first entry is removed.
Walk the continuation objects inside "async state machines" to generate the return call stack.
FOR DIAGNOSTIC PURPOSES ONLY.
The delegate that represents the head of an async continuation chain.
A helper method to get the label of the given delegate.
Gets the memory address of a given object.
The object to get the address for.
The memory address.
This method works when GCHandle will refuse because the type of object is a non-blittable type.
However, this method provides no guarantees that the address will remain valid for the caller,
so it is only useful for diagnostics and when we don't expect addresses to be changing much any more.
A helper method to find the async state machine from the given delegate.
This is the core to find the continuation delegate(s) inside the given async state machine.
The chain of objects is like this: async state machine -> async method builder -> task -> continuation object -> action.
There are 3 types of "async method builder": AsyncVoidMethodBuilder, AsyncTaskMethodBuilder, AsyncTaskMethodBuilder<T>.
We don't cover AsyncVoidMethodBuilder as it is used rarely and it can't be awaited either;
AsyncTaskMethodBuilder is a wrapper on top of AsyncTaskMethodBuilder<VoidTaskResult>.
A helper method to get field's value given the object and the field name.
The field names of "async state machine" are not fixed; the workaround is to find the field based on the suffix.
Tracks asynchronous operations and provides the ability to Join those operations to avoid
deadlocks while synchronously blocking the Main thread for the operation's completion.
For more complete comments please see the .
A thread-safe queue of elements
that self-scavenges elements that are executed by other means.
A synchronization context that forwards posted messages to the ambient job.
The owning job factory.
A flag indicating whether messages posted to this instance should execute
on the main thread.
The owning job. May be null from the beginning, or cleared after task completion.
Initializes a new instance of the class
that is affinitized to the main thread.
The that created this instance.
Initializes a new instance of the class.
The that owns this instance.
A value indicating whether messages posted to this instance should execute on the main thread.
Gets a value indicating whether messages posted to this instance should execute
on the main thread.
Forwards the specified message to the job this instance belongs to if applicable; otherwise to the factory.
Forwards a message to the ambient job and blocks on its execution.
Called by the joinable task when it has completed.
Stores the top-most JoinableTask that is completing on the current thread, if any.
The that began the async operation.
Store the task's initial creationOptions.
The serializable token associated with this particular .
This will be created when the was created with a parent token
or lazily created when this needs to be serialized.
Other instances of that should be posted
to with any main thread bound work.
The to track dependencies between tasks.
The collections that this job is a member of.
The returned by the async delegate that this JoinableTask originally executed,
or a if the property was observed before
had given us a Task.
This is until after returns a (or the property is observed),
and retains its value even after this JoinableTask completes.
An event that is signaled when any queue in the dependent has item to process. Lazily constructed.
The is triggered by this JoinableTask, this allows a quick access to the event.
The uplimit of the number pending events. The real number can be less because dependency can be removed, or a pending event can be processed.
The number is critical, so it should only be updated in the lock region.
The queue of work items. Lazily constructed.
Stores the task's initial delegate so we could show its full name in hang report.
This may not *actually* be the real delegate that was invoked for this instance, but
it's the meaningful one that should be shown in hang reports.
Backing field for the property.
Initializes a new instance of the class.
The instance that began the async operation.
A value indicating whether the launching thread will synchronously block for this job's completion.
An optional token that identifies one or more instances, typically in other processes, that serve as 'parents' to this one.
The used to customize the task's behavior.
The entry method's info for diagnostics.
No other flags defined.
This task was originally started as a synchronously executing one.
This task was originally started on the main thread.
This task has had its Complete method called, but may have lingering continuations to execute.
This task has completed.
This exact task has been passed to the method.
This exact task has been passed to the method
on the main thread.
Gets a value indicating whether the async operation represented by this instance has completed,
as represented by its property's value.
Gets the asynchronous task that completes when the async operation completes.
Gets the JoinableTask that is completing (i.e. synchronously blocking) on this thread, nearest to the top of the callstack.
This property is intentionally non-public to avoid its abuse by outside callers.
Gets a value indicating whether an awaiter should capture the
.
As a library, we generally wouldn't capture the
when awaiting, except that where our thread is synchronously blocking anyway, it is actually
more efficient to capture the so that the continuation
will resume on the blocking thread instead of occupying yet another one in order to execute.
In fact, when threadpool starvation conditions exist, resuming on the calling thread
can avoid significant delays in executing an often trivial continuation.
Gets a value indicating whether the async operation and any extra queues tracked by this instance has completed.
Gets or sets the set of nesting factories (excluding )
that own JoinableTasks that are nesting this one.
Gets a weak reference to this object.
Gets or sets potential unreachable dependent nodes.
This is a special collection only used in synchronized task when there are other tasks which are marked to block it through ref-count code.
However, it is possible the reference count is retained by loop-dependencies. This collection tracking those items,
so the clean-up logic can run when it becomes necessary.
Gets a value indicating whether PotentialUnreachableDependents is empty.
Gets the flags set on this task.
Gets the task's initial creationOptions.
Gets the entry method's info so we could show its full name in hang report.
Gets a value indicating whether this task has a non-empty queue.
FOR DIAGNOSTICS COLLECTION ONLY.
Gets a snapshot of all work queued to the main thread.
FOR DIAGNOSTICS COLLECTION ONLY.
Gets a snapshot of all work queued to synchronously blocking threadpool thread.
FOR DIAGNOSTICS COLLECTION ONLY.
Gets the collections this task belongs to.
FOR DIAGNOSTICS COLLECTION ONLY.
Gets or sets a value indicating whether this task has had its Complete() method called..
Gets JoinableTaskContext for to access locks.
Synchronously blocks the calling thread until the operation has completed.
If the caller is on the Main thread (or is executing within a JoinableTask that has access to the main thread)
the caller's access to the Main thread propagates to this JoinableTask so that it may also access the main thread.
A cancellation token that will exit this method before the task is completed.
Shares any access to the main thread the caller may have
Joins any main thread affinity of the caller with the asynchronous operation to avoid deadlocks
in the event that the main thread ultimately synchronously blocks waiting for the operation to complete.
A cancellation token that will revert the Join and cause the returned task to complete
before the async operation has completed.
A task that completes after the asynchronous operation completes and the join is reverted.
Gets an awaiter that is equivalent to calling .
A task whose result is the result of the asynchronous operation.
Gets the full token that should be serialized when this owns the context to be shared.
The token; or when this task is already completed.
Looks up the that serves as this instance's parent due to the token provided when this was created.
A task; or if no parent token was provided at construction time or no match was found (possibly due to the parent having already completed).
Gets a very likely value whether the main thread is blocked by this .
Instantiate a that can track the ultimate result of .
The new task completion source.
The implementation should be sure to instantiate a that will
NOT inline continuations, since we'll be completing this ourselves, potentially while holding a private lock.
Retrieves the from a .
The task completion source.
The that will complete with this .
Completes a .
The task to read a result from.
The created earlier with to apply the result to.
Fires when the underlying Task is completed.
The actual result from .
Runs a loop to process all queued work items, returning only when the task is completed.
Get the number of pending messages to be process for the synchronous task.
The synchronous task.
The number of events need be processed by the synchronous task in the current JoinableTask.
This is a helper method to parepare notifing the sychronous task for pending events.
It must be called inside JTF lock, and returns a collection of event to trigger later. (Those events must be triggered out of the JTF lock.)
Adds the specified flags to the field.
Gets the original token provided by the remote parent task.
Gets the unique ID that identifies the owning in the dictionary.
Serializes this token as a string.
A string that identifies the owner and retains information about its parents, if any. May be if the owning task has already completed.
Creates a when a parent token is provided.
The parent token, if any.
The owning task.
The token, if any is required.
Creates a for a given if it has not yet completed.
The owning task.
A token, if the task has not yet completed; otherwise .
A collection of incomplete objects.
Any completed is automatically removed from the collection.
A value indicating whether joinable tasks are only removed when completed or removed as many times as they were added.
A human-readable name that may appear in hang reports.
The to track dependencies between tasks.
An event that is set when the collection is empty (lazily initialized).
Initializes a new instance of the class.
The instance to which this collection applies.
if JoinableTask instances added to the collection multiple times should remain in the collection until they are
either removed the same number of times or until they are completed;
causes the first Remove call for a JoinableTask to remove it from this collection regardless
how many times it had been added.
Gets the to which this collection belongs.
Gets or sets a human-readable name that may appear in hang reports.
This property should *not* be set to a value that may disclose
personally identifiable information or other confidential data
since this value may be included in hang reports sent to a third party.
Gets JoinableTaskContext for to access locks.
Gets a value indicating whether we need count reference for child dependent nodes.
Adds the specified to this collection.
The to add to the collection.
As the collection only stores *incomplete* instances,
if the is already completed, it will not be added to the collection and this method will simply return.
Any instances added to the collection will be automatically removed upon completion.
Removes the specified from this collection,
or decrements the ref count if this collection tracks that.
The to remove.
Completed instances are automatically removed from the collection.
Calling this method to remove them is not necessary.
Shares access to the main thread that the caller's JoinableTask may have (if any) with all
JoinableTask instances in this collection until the returned value is disposed.
A value to dispose of to revert the join.
Calling this method when the caller is not executing within a JoinableTask safely no-ops.
Joins the caller's context to this collection till the collection is empty.
A task that completes when this collection is empty.
Joins the caller's context to this collection till the collection is empty.
A cancellation token.
A task that completes when this collection is empty, or is canceled when is canceled.
Checks whether the specified joinable task is a member of this collection.
Enumerates the tasks in this collection.
Enumerates the tasks in this collection.
A value whose disposal cancels a operation.
Initializes a new instance of the struct.
The Main thread controlling SingleThreadSynchronizationContext to use to accelerate execution of Main thread bound work.
The instance that created this value.
Cancels the operation.
A common context within which joinable tasks may be created and interact to avoid deadlocks.
There are three rules that should be strictly followed when using or interacting
with JoinableTasks:
1. If a method has certain thread apartment requirements (STA or MTA) it must either:
a) Have an asynchronous signature, and asynchronously marshal to the appropriate
thread if it isn't originally invoked on a compatible thread.
The recommended way to switch to the main thread is:
await JoinableTaskFactory.SwitchToMainThreadAsync();
b) Have a synchronous signature, and throw an exception when called on the wrong thread.
In particular, no method is allowed to synchronously marshal work to another thread
(blocking while that work is done). Synchronous blocks in general are to be avoided
whenever possible.
2. When an implementation of an already-shipped public API must call asynchronous code
and block for its completion, it must do so by following this simple pattern:
JoinableTaskFactory.Run(async delegate {
await SomeOperationAsync(...);
});
3. If ever awaiting work that was started earlier, that work must be Joined.
For example, one service kicks off some asynchronous work that may later become
synchronously blocking:
JoinableTask longRunningAsyncWork = JoinableTaskFactory.RunAsync(async delegate {
await SomeOperationAsync(...);
});
Then later that async work becomes blocking:
longRunningAsyncWork.Join();
or perhaps:
await longRunningAsyncWork;
Note however that this extra step is not necessary when awaiting is done
immediately after kicking off an asynchronous operation.
Contributes data for a hang report.
The hang report contribution.
Contributes data for a hang report.
The hang report contribution. Null values should be ignored.
The expected length of the serialized task ID.
This value is the length required to hex-encode a 64-bit integer. We use for task IDs, so this is appropriate.
A "global" lock that allows the graph of interconnected sync context and JoinableSet instances
communicate in a thread-safe way without fear of deadlocks due to each taking their own private
lock and then calling others, thus leading to deadlocks from lock ordering issues.
Yes, global locks should be avoided wherever possible. However even MEF from the .NET Framework
uses a global lock around critical composition operations because containers can be interconnected
in arbitrary ways. The code in this file has a very similar problem, so we use a similar solution.
Except that our lock is only as global as the JoinableTaskContext. It isn't static.
An AsyncLocal value that carries the joinable instance associated with an async operation.
The set of tasks that have started but have not yet completed.
All access to this collection should be guarded by locking this collection.
The stack of tasks which synchronously blocks the main thread in the initial stage (before it yields and CompleteOnCurrentThread starts.)
Normally we expect this stack contains 0 or 1 task. When a synchronous task starts another synchronous task in the initialization stage,
we might get more than 1 tasks, but it should be very rare to exceed 2 tasks.
All access to this collection should be guarded by locking this collection.
A set of receivers of hang notifications.
All access to this collection should be guarded by locking this collection.
The ManagedThreadID for the main thread.
A dictionary of incomplete objects for which serializable identifiers have been requested.
Only access this while locking .
A unique instance ID that is used when creating IDs for JoinableTasks that come from this instance.
The next unique ID to assign to a for which a token is required.
The count of s blocking the main thread.
A single joinable task factory that itself cannot be joined.
Initializes a new instance of the class
assuming the current thread is the main thread and
will provide the means to switch
to the main thread from another thread.
Initializes a new instance of the class.
The thread to switch to in .
If omitted, the current thread will be assumed to be the main thread.
The synchronization context to use to switch to the main thread.
Gets the factory which creates joinable tasks
that do not belong to a joinable task collection.
Gets the main thread that can be shared by tasks created by this context.
Gets a value indicating whether the caller is executing on the main thread.
Gets a value indicating whether the caller is currently running within the context of a joinable task.
Use of this property is generally discouraged, as any operation that becomes a no-op when no
ambient JoinableTask is present is very cheap. For clients that have complex algorithms that are
only relevant if an ambient joinable task is present, this property may serve to skip that for
performance reasons.
Gets a value indicating whether the main thread is blocked by any joinable task.
Gets the underlying that controls the main thread in the host.
Gets the context-wide synchronization lock.
Gets or sets the caller's ambient joinable task.
Gets a which, when applied,
suppresses any message pump that may run during synchronous blocks
of the calling thread.
The default implementation of this property is effective
in builds of this assembly that target the .NET Framework.
But on builds that target the portable profile, it should be
overridden to provide an effective platform-specific solution.
Conceals any JoinableTask the caller is associated with until the returned value is disposed.
A value to dispose of to restore visibility into the caller's associated JoinableTask, if any.In some cases asynchronous work may be spun off inside a delegate supplied to Run,
so that the work does not have privileges to re-enter the Main thread until the
call has returned and the UI thread is idle.
To prevent the asynchronous work from automatically being allowed to re-enter the Main thread,
wrap the code that calls the asynchronous task in a using block with a call to this method
as the expression.
this.JoinableTaskContext.RunSynchronously(async delegate {
using(this.JoinableTaskContext.SuppressRelevance()) {
var asyncOperation = Task.Run(async delegate {
// Some background work.
await this.JoinableTaskContext.SwitchToMainThreadAsync();
// Some Main thread work, that cannot begin until the outer RunSynchronously call has returned.
});
}
// Because the asyncOperation is not related to this Main thread work (it was suppressed),
// the following await *would* deadlock if it were uncommented.
////await asyncOperation;
});
Gets a value indicating whether the main thread is blocked for the caller's completion.
Gets a very likely value whether the main thread is blocked for the caller's completion.
It is less accurate when the UI thread blocking task just starts and hasn't been blocked yet, or the dependency chain is just removed.
However, unlike , this implementation is lock free, and faster in high contention scenarios.
Creates a joinable task factory that automatically adds all created tasks
to a collection that can be jointly joined.
The collection that all tasks should be added to.
Creates a collection for in-flight joinable tasks.
A new joinable task collection.
Captures the caller's context and serializes it as a string
that is suitable for application via a subsequent call to .
A string that represent the current context, or if there is none.
To optimize calling patterns, this method returns even when inside a context
when this was initialized without a , which means no main thread exists
and thus there is no need to capture and reapply tokens.
Raised when a joinable task starts.
The task that has started.
Raised when a joinable task completes.
The completing task.
Raised when it starts to wait a joinable task to complete in the main thread.
The task requires to be completed.
Registers a node for notification when a hang is detected.
The instance to notify.
A value to dispose of to cancel registration.
Increment the count of s blocking the main thread.
This method should only be called on the main thread.
Decrement the count of s blocking the main thread.
This method should only be called on the main thread.
Reserves a unique ID for the given and records the association in the table.
The to associate with the new ID.
An ID assignment that is unique for this .
It must be passed to when the task completes to avoid a memory leak.
Applies the result of a call to to the caller's context.
The result of a prior call.
The task referenced by the parent token if it came from our context and is still running; otherwise .
Assembles a new token based on a parent token and the unique ID for some .
The value previously obtained from .
The parent token the was created with, if any.
A token that may be serialized to recreate the dependency chain for this and its remote parents.
Removes an association between a and a unique ID that was generated for it
from the table.
The value previously obtained from .
This method must be called when a is completed to avoid a memory leak.
Invoked when a hang is suspected to have occurred involving the main thread.
The duration of the current hang.
The number of times this hang has been reported, including this one.
A random GUID that uniquely identifies this particular hang.
A single hang occurrence may invoke this method multiple times, with increasing
values in the parameter.
Invoked when an earlier hang report is false alarm.
Creates a factory without a .
Used for initializing the property.
Disposes managed and unmanaged resources held by this instance.
if was called; if the object is being finalized.
Searches a parent token for a task ID that belongs to this instance.
A parent token.
The 0-based index into the string where the context of the local task ID begins, if found; otherwise -1.
Gets the task ID that came from this that is carried in a given a parent token.
A parent token.
The characters that formulate the task ID that originally came from this instance, if found; otherwise an empty span.
A structure that clears CallContext and SynchronizationContext async/thread statics and
restores those values when this structure is disposed.
Initializes a new instance of the struct.
The instance that created this value.
Reverts the async local and thread static values to their original values.
A class to encapsulate the details of a possible hang.
An instance of this class will be passed to the
instances who registered the hang notifications.
Initializes a new instance of the class.
The duration of the current hang.
The number of times this hang has been reported, including this one.
A random GUID that uniquely identifies this particular hang.
The method that served as the entrypoint for the JoinableTask.
Gets the length of time this hang has lasted so far.
Gets the number of times this particular hang has been reported, including this one.
Gets a unique GUID identifying this particular hang.
If the same hang is reported multiple times (with increasing duration values)
the value of this property will remain constant.
Gets the method that served as the entrypoint for the JoinableTask that now blocks a thread.
The method indicated here may not be the one that is actually blocking a thread,
but typically a deadlock is caused by a violation of a threading rule which is under
the entrypoint's control. So usually regardless of where someone chooses the block
a thread for the completion of a , a hang usually indicates
a bug in the code that created it.
This value may be used to assign the hangs to different buckets based on this method info.
A value whose disposal cancels hang registration.
The node to receive notifications. May be if has already been called.
Initializes a new instance of the class.
Removes the node from hang notifications.
An exception thrown when the configuration provided to the
are incorrect or a virtual method is overridden such that it violates a contract.
This exception should not be caught. It is thrown when the application has a programming fault.
Initializes a new instance of the class.
Initializes a new instance of the class.
The message for the exception.
Initializes a new instance of the class.
The message for the exception.
The inner exception.
Initializes a new instance of the class.
A customizable source of instances.
The inner JoinableTaskContext.
A single joinable task factory that itself cannot be joined.
Initializes a new instance of the class.
The inner JoinableTaskContext.
Gets the factory which creates joinable tasks
that do not belong to a joinable task collection.
Gets the main thread that can be shared by tasks created by this context.
Gets a value indicating whether the caller is executing on the main thread.
Gets the inner wrapped context.
Creates a joinable task factory that automatically adds all created tasks
to a collection that can be jointly joined.
The collection that all tasks should be added to.
Creates a collection for in-flight joinable tasks.
A new joinable task collection.
Conceals any JoinableTask the caller is associated with until the returned value is disposed.
A value to dispose of to restore visibility into the caller's associated JoinableTask, if any.In some cases asynchronous work may be spun off inside a delegate supplied to Run,
so that the work does not have privileges to re-enter the Main thread until the
call has returned and the UI thread is idle.
To prevent the asynchronous work from automatically being allowed to re-enter the Main thread,
wrap the code that calls the asynchronous task in a using block with a call to this method
as the expression.
this.JoinableTaskContext.RunSynchronously(async delegate {
using(this.JoinableTaskContext.SuppressRelevance()) {
var asyncOperation = Task.Run(async delegate {
// Some background work.
await this.JoinableTaskContext.SwitchToMainThreadAsync();
// Some Main thread work, that cannot begin until the outer RunSynchronously call has returned.
});
}
// Because the asyncOperation is not related to this Main thread work (it was suppressed),
// the following await *would* deadlock if it were uncommented.
////await asyncOperation;
});
Gets a value indicating whether the main thread is blocked for the caller's completion.
Invoked when a hang is suspected to have occurred involving the main thread.
Describes the hang in detail.
A single hang occurrence may invoke this method multiple times, with increasing
values in the values
in the parameter.
Invoked when an earlier hang report is false alarm.
The duration of the total waiting time.
A GUID that uniquely identifies the earlier hang report.
Invoked when a hang is suspected to have occurred involving the main thread.
The duration of the current hang.
The number of times this hang has been reported, including this one.
A random GUID that uniquely identifies this particular hang.
A single hang occurrence may invoke this method multiple times, with increasing
values in the parameter.
Creates a factory without a .
Used for initializing the property.
Registers with the inner to receive hang notifications.
A value to dispose of to cancel hang notifications.
Specifies flags that control optional behavior for the creation and execution of tasks.
Specifies that the default behavior should be used.
Specifies that a task will be a long-running operation. It provides a hint to the
that hang report should not be fired, when the main thread task is blocked on it.
Methods to maintain dependencies between .
Those methods are expected to be called by or only to maintain relationship between them, and should not be called directly by other code.
Gets a value indicating whether there is no child depenent item.
This method is expected to be used with the JTF lock.
Checks whether a task or collection is a directly dependent of this item.
This method is expected to be used with the JTF lock.
Gets a value indicating whether the main thread is waiting for the task's completion.
Gets a likely value whether the main thread is blocked for the caller's completion.
Adds a instance as one that is relevant to the async operation.
The current joinableTask or collection.
The to join as a child.
Removes a instance as one that is no longer relevant to the async operation.
The current joinableTask or collection.
The to join as a child.
Ignore refCount, it is being used when the child task is completed.
Gets all dependent nodes registered in the dependency collection.
This method is expected to be used with the JTF lock.
Check whether a task is being tracked in our tracking list.
Calculate the collection of events we need trigger after we enqueue a request.
This method is expected to be used with the JTF lock.
The current joinableTask or collection.
True if we want to find tasks to process the main thread queue. Otherwise tasks to process the background queue.
The collection of synchronous tasks we need notify.
Gets a snapshot of all joined tasks.
FOR DIAGNOSTICS COLLECTION ONLY.
This method is expected to be used with the JTF lock.
Recursively adds this joinable and all its dependencies to the specified set, that are not yet completed.
When the current dependent node is a synchronous task, this method is called before the thread is blocked to wait it to complete.
This adds the current task to the dependingSynchronousTaskTracking list of the task itself (which will propergate through its dependencies.)
After the task is finished, is called to revert this change.
This method is expected to be used with the JTF lock.
The current joinableTask or collection.
Return the JoinableTask which has already had pending requests to be handled.
The number of pending requests.
When the current dependent node is a synchronous task, this method is called after the synchronous is completed, and the thread is no longer blocked.
This removes the current task from the dependingSynchronousTaskTracking list of the task itself (and propergate through its dependencies.)
It reverts the data structure change done in the .
Remove all synchronous tasks tracked by the this task.
This is called when this task is completed.
This method is expected to be used with the JTF lock.
Get all tasks inside the candidate sets tasks, which are depended by one or more task in the source tasks list.
A collection of JoinableTasks represents source tasks.
A collection of JoinableTasks which represents candidates.
A set of tasks matching the condition.
Computes dependency graph to clean up all potential unreachable dependents items.
A thread blocking sychornizing task.
Returns all reachable nodes in the connected dependency graph, if unreachable dependency is found.
True if it removes any unreachable items.
Force to clean up all unreachable dependent item, so they are not marked to block the syncTask.
The thread blocking task.
Unreachable dependent items.
All reachable items.
Preserve data for the JoinableTask dependency tree. It is holded inside either a or a .
Do not call methods/properties directly anywhere out of .
A map of jobs that we should be willing to dequeue from when we control the UI thread, and a ref count. Lazily constructed.
When the value in an entry is decremented to 0, the entry is removed from the map.
The head of a singly linked list of records to track which task may process events of this task.
This list should contain only tasks which need be completed synchronously, and depends on this task.
Gets a value indicating whether the is empty.
Gets a snapshot of all joined tasks.
FOR DIAGNOSTICS COLLECTION ONLY.
This method is expected to be used with the JTF lock.
The current joinableTask or collection contains this data.
Adds a instance as one that is relevant to the async operation.
The current joinableTask or collection contains to add a dependency.
The to join as a child.
Removes a instance as one that is no longer relevant to the async operation.
The current joinableTask or collection contains to remove a dependency.
The to join as a child.
Ignore refCount, it is being used when the child task is completed.
Recursively adds this joinable and all its dependencies to the specified set, that are not yet completed.
The current joinableTask or collection contains this data.
A collection to hold found.
When the current dependent node is a synchronous task, this method is called before the thread is blocked to wait it to complete.
This adds the current task to the of the task itself (which will propergate through its dependencies.)
After the task is finished, is called to revert this change.
This method is expected to be used with the JTF lock.
The synchronized joinableTask.
Return the JoinableTask which has already had pending requests to be handled.
The number of pending requests.
When the current dependent node is a synchronous task, this method is called after the synchronous is completed, and the thread is no longer blocked.
This removes the current task from the of the task itself (and propergate through its dependencies.)
It reverts the data structure change done in the .
The synchronized joinableTask.
Compute all reachable nodes from a synchronous task. Because we use the result to clean up invalid
items from the remain task, we will remove valid task from the collection, and stop immediately if nothing is left.
The current joinableTask or collection owns the data.
All reachable dependency nodes. This is not a completed list, if there is no remain node.
Remain dependency nodes we want to check. After the execution, it will retain non-reachable nodes.
Force to clean up all unreachable dependent item, so they are not marked to block the syncTask.
The thread blocking task.
Unreachable dependent items.
All reachable items.
Gets all dependent nodes registered in the
This method is expected to be used with the JTF lock.
Checks whether a dependent node is inside .
This method is expected to be used with the JTF lock.
Gets a value indicating whether the main thread is waiting for the task's completion
This method is expected to be used with the JTF lock.
Gets a likely value whether the main thread is blocked for the caller's completion.
Remove all synchronous tasks tracked by the this task.
This is called when this task is completed.
This method is expected to be used with the JTF lock.
Check whether a task is being tracked in our tracking list.
Calculate the collection of events we need trigger after we enqueue a request.
This method is expected to be used with the JTF lock.
True if we want to find tasks to process the main thread queue. Otherwise tasks to process the background queue.
The collection of synchronous tasks we need notify.
Applies all synchronous tasks tracked by this task to a new child/dependent task.
The current joinableTask or collection owns the data.
The new child task.
Pairs of synchronous tasks we need notify and the event source triggering it, plus the number of pending events.
Tracks a new synchronous task for this task.
A synchronous task is a task blocking a thread and waits it to be completed. We may want the blocking thread
to process events from this task.
The current joinableTask or collection.
The synchronous task.
The total events need be processed.
The task causes us to trigger the event of the synchronous task, so it can process new events. Null means we don't need trigger any event.
Remove a synchronous task from the tracking list.
The current joinableTask or collection.
The synchronous task.
We always remove it from the tracking list if it is true. Otherwise, we keep tracking the reference count.
Remove a synchronous task from the tracking list of a list of tasks.
A list of tasks we need update the tracking list.
The synchronous task we want to remove.
We always remove it from the tracking list if it is true. Otherwise, we keep tracking the reference count.
Remove a synchronous task from the tracking list of this task.
The current joinableTask or collection.
The synchronous task.
If it is not null, it will contain all dependency nodes which can track the synchronous task. We will ignore reference count in that case.
This will retain the tasks which still tracks the synchronous task.
Get how many number of synchronous tasks in our tracking list.
Removes all synchronous tasks we applies to a dependent task, after the relationship is removed.
The original dependent task.
The record of a pending notification we need send to the synchronous task that we have some new messages to process.
Gets the synchronous task which need process new messages.
Gets one JoinableTask which may have pending messages. We may have multiple new JoinableTasks which contains pending messages.
This is just one of them. It gives the synchronous task a way to start quickly without searching all messages.
Gets the total number of new pending messages. The real number could be less than that, but should not be more than that.
A single linked list to maintain synchronous JoinableTask depends on the current task,
which may process the queue of the current task.
Gets or sets the chain of the single linked list.
Gets the synchronous task.
Gets or sets the reference count. We remove the item from the list, if it reaches 0.
A factory for starting asynchronous tasks that can mitigate deadlocks
when the tasks require the Main thread of an application and the Main
thread may itself be blocking on the completion of a task.
For more complete comments please see the .
The that owns this instance.
The collection to add all created tasks to. May be .
Backing field for the property.
Initializes a new instance of the class.
The context for the tasks created by this factory.
Initializes a new instance of the class
that adds all generated jobs to the specified collection.
The collection that all tasks created by this factory will belong to till they complete.
Initializes a new instance of the class.
The context for the tasks created by this factory.
The collection that all tasks created by this factory will belong to till they complete. May be null.
Gets the joinable task context to which this factory belongs.
Gets the synchronization context to apply before executing work associated with this factory.
Gets the collection to which created tasks belong until they complete. May be null.
Gets or sets the timeout after which no activity while synchronously blocking
suggests a hang has occurred.
Gets the underlying that controls the main thread in the host.
Gets an awaitable whose continuations execute on the synchronization context that this instance was initialized with,
in such a way as to mitigate both deadlocks and reentrancy.
A token whose cancellation will immediately schedule the continuation
on a threadpool thread and will cause the continuation to throw ,
even if the caller is already on the main thread.
An awaitable.
Thrown back at the awaiting caller if is canceled,
even if the caller is already on the main thread.
private async Task SomeOperationAsync() {
// on the caller's thread.
await DoAsync();
// Now switch to a threadpool thread explicitly.
await TaskScheduler.Default;
// Now switch to the Main thread to talk to some STA object.
await this.JobContext.SwitchToMainThreadAsync();
STAService.DoSomething();
}
Gets an awaitable whose continuations execute on the synchronization context that this instance was initialized with,
in such a way as to mitigate both deadlocks and reentrancy.
A value indicating whether the caller should yield even if
already executing on the main thread.
A token whose cancellation will immediately schedule the continuation
on a threadpool thread and will cause the continuation to throw ,
even if the caller is already on the main thread.
An awaitable.
Thrown back at the awaiting caller if is canceled,
even if the caller is already on the main thread.
private async Task SomeOperationAsync()
{
// This first part can be on the caller's thread, whatever that is.
DoSomething();
// Now switch to the Main thread to talk to some STA object.
// Supposing it is also important to *not* do this step on our caller's callstack,
// be sure we yield even if we're on the UI thread.
await this.JoinableTaskFactory.SwitchToMainThreadAsync(alwaysYield: true);
STAService.DoSomething();
}
Runs the specified asynchronous method to completion while synchronously blocking the calling thread.
The type of value returned by the asynchronous operation.
The asynchronous method to execute.
The used to customize the task's behavior.
The result of the Task returned by .Any exception thrown by the delegate is rethrown in its original type to the caller of this method.When the delegate resumes from a yielding await, the default behavior is to resume in its original context
as an ordinary async method execution would. For example, if the caller was on the main thread, execution
resumes after an await on the main thread; but if it started on a threadpool thread it resumes on a threadpool thread.
Responds to calls to
by scheduling a continuation to execute on the Main thread.
The callback to invoke.
Posts a callback to the main thread via the underlying dispatcher,
or to the threadpool when no dispatcher exists on the main thread.
Runs the specified asynchronous method.
The asynchronous method to execute.
The used to customize the task's behavior.
The delegate to record as the entrypoint for this JoinableTask.
Posts a message to the specified underlying SynchronizationContext for processing when the main thread
is freely available.
The callback to invoke.
State to pass to the callback.
Raised when a joinable task has requested a transition to the main thread.
The task requesting the transition to the main thread.
This event may be raised on any thread, including the main thread.
Raised whenever a joinable task has completed a transition to the main thread.
The task whose request to transition to the main thread has completed.
A value indicating whether the transition was cancelled before it was fulfilled.
This event is usually raised on the main thread, but can be on another thread when is .
Synchronously blocks the calling thread for the completion of the specified task.
If running on the main thread, any applicable message pump is suppressed
while the thread sleeps.
The task whose completion is being waited on.
Implementations should take care that exceptions from faulted or canceled tasks
not be thrown back to the caller.
Synchronously blocks the calling thread for the completion of the specified task.
The task whose completion is being waited on.
Implementations should take care that exceptions from faulted or canceled tasks
not be thrown back to the caller.
Check whether the current joinableTask is waiting on a long running task.
Return true if the current synchronous task on the thread is waiting on a long running task.
Adds the specified joinable task to the applicable collection.
Throws an exception if an active AsyncReaderWriterLock
upgradeable read or write lock is held by the caller.
This is important to call from the Run and Run{T} methods because
if they are called from within an ARWL upgradeable read or write lock,
then Run will synchronously block while inside the semaphore held
by the ARWL that prevents concurrency. If the delegate within Run
yields and then tries to reacquire the ARWL lock, it will be unable
to re-enter the semaphore, leading to a deadlock.
Instead, callers who hold UR/W locks should never call Run, or should
switch to the STA thread first in order to exit the semaphore before
calling the Run method.
Wraps the invocation of an async method such that it may
execute asynchronously, but may potentially be
synchronously completed (waited on) in the future.
The asynchronous method to execute.
The entry method's info for diagnostics.
Invokes an async delegate on the caller's thread, and yields back to the caller when the async method yields.
The async delegate is invoked in such a way as to mitigate deadlocks in the event that the async method
requires the main thread while the main thread is blocked waiting for the async method's completion.
The type of value returned by the asynchronous operation.
The method that, when executed, will begin the async operation.
A value indicating whether the caller is synchronously blocking.
An optional token that identifies one or more instances, typically in other processes, that serve as 'parents' to this one.
The used to customize the task's behavior.
An object that tracks the completion of the async operation, and allows for later synchronous blocking of the main thread for completion if necessary.
Exceptions thrown by the delegate are captured by the returned .When the delegate resumes from a yielding await, the default behavior is to resume in its original context
as an ordinary async method execution would. For example, if the caller was on the main thread, execution
resumes after an await on the main thread; but if it started on a threadpool thread it resumes on a threadpool thread.
An awaitable struct that facilitates an asynchronous transition to the Main thread.
Initializes a new instance of the struct.
Initializes a new instance of the struct.
Returns an awaitable for the specified
operation that will not throw an exception if cancellation is requested.
An awaitable.
Gets the awaiter.
An awaiter struct that facilitates an asynchronous transition to the Main thread.
Holds the reference to the struct, so that all the copies of will hold
the same object.
This must be initialized to either null or an object holding no value.
If this starts as an object object holding no value, then it means we are interested in the cancellation,
and its state would be changed following one of these 2 patterns determined by the execution order.
1. if finishes before is being executed on main thread,
then this will hold the real registered value after , and
will dispose that value and set a default value of .
2. if is executed on main thread before registers the cancellation,
then this will hold a default value of , and
would not touch it.
Initializes a new instance of the struct.
Gets a value indicating whether the caller is already on the Main thread.
Schedules a continuation for execution on the Main thread
without capturing the ExecutionContext.
The action to invoke when the operation completes.
Schedules a continuation for execution on the Main thread.
The action to invoke when the operation completes.
Called on the Main thread to prepare it to execute the continuation.
Schedules a continuation for execution on the Main thread.
The action to invoke when the operation completes.
A value indicating whether to capture and reapply the current ExecutionContext for the continuation.
A value to construct with a C# using block in all the Run method overloads
to setup and teardown the boilerplate stuff.
Initializes a new instance of the struct
and sets up the synchronization contexts for the
family of methods.
Reverts the execution context to its previous state before this struct was created.
A delegate wrapper that ensures the delegate is only invoked at most once.
Executes the delegate if it has not already executed.
Executes the delegate if it has not already executed.
The job that created this wrapper.
The delegate to invoke. if it has already been invoked.
May be of type or .
The value to pass to the delegate if it is a .
Stores execution callbacks for .
Initializes a new instance of the class.
Gets a value indicating whether this instance has already executed.
Gets a string that describes the delegate that this instance invokes.
FOR DIAGNOSTIC PURPOSES ONLY.
Initializes a new instance of the class.
The joinable task responsible for this work.
The delegate being wrapped.
An instance of .
Initializes a new instance of the class
that describes the specified callback.
The joinable task responsible for this work.
The callback to invoke.
The state object to pass to the callback.
An instance of .
Registers for a callback when this instance is executed.
Unregisters a callback for when this instance is executed.
Walk the continuation objects inside "async state machines" to generate the return callstack.
FOR DIAGNOSTIC PURPOSES ONLY.
Executes the delegate if it has not already executed.
Invokes handler.
A helper class for integration with Visual Studio.
APIs in this file are intended for Microsoft internal use only
and are subject to change without notice.
Tracks asynchronous operations and provides the ability to Join those operations to avoid
deadlocks while synchronously blocking the Main thread for the operation's completion.
The type of value returned by the asynchronous operation.
For more complete comments please see the .
Initializes a new instance of the class.
Gets the asynchronous task that completes when the async operation completes.
Joins any main thread affinity of the caller with the asynchronous operation to avoid deadlocks
in the event that the main thread ultimately synchronously blocks waiting for the operation to complete.
A cancellation token that will exit this method before the task is completed.
A task that completes after the asynchronous operation completes and the join is reverted, with the result of the operation.
Synchronously blocks the calling thread until the operation has completed.
If the calling thread is the Main thread, deadlocks are mitigated.
A cancellation token that will exit this method before the task is completed.
The result of the asynchronous operation.
Gets an awaiter that is equivalent to calling .
A task whose result is the result of the asynchronous operation.
A non-generic class used to store statics that do not vary by generic type argument.
Gets a value indicating whether we execute Windows 7 code even on later versions of Windows.
The for Windows 8.
Gets a value indicating whether the current operating system is Windows 8 or later.
A thread-safe collection optimized for very small number of non-null elements.
The type of elements to be stored.
The collection is alloc-free for storage, retrieval and enumeration of collection sizes of 0 or 1.
Beyond that causes one allocation for an immutable array that contains the entire collection.
The single value or array of values stored by this collection. Null if empty.
Returns an enumerator for a current snapshot of the collection.
Returns an enumerator for a current snapshot of the collection.
Returns an enumerator for a current snapshot of the collection.
Adds an element to the collection.
Removes an element from the collection.
Checks for reference equality between the specified value and an element of this collection.
The value to check for.
if a match is found; otherwise.
This method is intended to hide the Linq Contains extension method to avoid
the boxing of this struct and its Enumerator.
Atomically clears the collection's contents and returns an enumerator over the prior contents.
Combines the previous contents of the collection with one additional value.
The collection's prior contents.
The value to add to the collection.
The new value to store as the collection.
Removes a value from contents of the collection.
The collection's prior contents.
The value to remove from the collection.
The new value to store as the collection.
A SynchronizationContext whose synchronously blocking Wait method does not allow
any reentrancy via the message pump.
A shared singleton.
Initializes a new instance of the class.
Gets a shared instance of this class.
Synchronously blocks without a message pump.
An array of type that contains the native operating system handles.
true to wait for all handles; false to wait for any handle.
The number of milliseconds to wait, or (-1) to wait indefinitely.
The array index of the object that satisfied the wait.
A that executes messages in the order they are received.
Delegates will be invoked in the order they are received on the threadpool.
No two delegates will ever be executed concurrently, but may permit
a delegate to execute inline on another.
Note that if the delegate invokes an async method, the delegate formally ends
when the async method yields for the first time or returns, whichever comes first.
Once that delegate returns the next delegate can be executed.
The queue of work to execute, if this is the original instance.
A value indicating whether to set this instance as when invoking delegates.
The original instance (on which was called).
Set to the when a delegate is currently executing.
Initializes a new instance of the class.
A value indicating whether to set this instance as when invoking delegates.
This has the effect that async methods that are invoked on this
will execute their continuations on this as well unless they use with as the argument.
Initializes a new instance of the class
that is a copy of an existing instance.
The instance to copy from.
Occurs when posted work throws an unhandled exception.
Any exception thrown from this handler will crash the process.
Executes queued work on the threadpool, one at a time.
A task that always completes successfully.
Converts a delegate which assumes an argument that is never null into a delegate which might be given a null value,
without adding an explicit null check.
The type of argument to be passed to the delegate.
The delegate which, according to the signature, does not expect .
The exact same referenced delegate, but with a signature that may expect .
Converts a delegate which assumes an argument that is never null into a delegate which might be given a null value,
without adding an explicit null check.
The type of argument to be passed to the delegate.The type of value returned from the delegate.
The delegate which, according to the signature, does not expect .
The exact same referenced delegate, but with a signature that may expect .
An incremental progress reporting mechanism that also allows
asynchronous awaiting for all reports to be processed.
The type of message sent in progress updates.
The synchronization object.
Applicable only when is null.
The handler to invoke for each progress update.
The set of progress reports that have started (but may not have finished yet).
Applicable only when is null.
The factory to use for invoking the .
Applicable only when is null.
A value indicating whether this instance was constructed on the main thread.
Applicable only when is not null.
The to use when invoking the to mitigate deadlocks.
May be null.
A collection of outstanding progress updates that have not completed execution.
Applicable only when is not null.
Initializes a new instance of the class.
A handler to invoke for each reported progress value.
Depending on the instance that is captured when this constructor is invoked,
it is possible that this handler instance could be invoked concurrently with itself.
Initializes a new instance of the class.
A handler to invoke for each reported progress value.
Depending on the instance that is captured when this constructor is invoked,
it is possible that this handler instance could be invoked concurrently with itself.
Initializes a new instance of the class.
A handler to invoke for each reported progress value.
It is possible that this handler instance could be invoked concurrently with itself.
A instance that can be used to mitigate deadlocks when is called and the requires the main thread.
Initializes a new instance of the class.
A handler to invoke for each reported progress value.
It is possible that this handler instance could be invoked concurrently with itself.
A instance that can be used to mitigate deadlocks when is called and the requires the main thread.
Receives a progress update.
The value representing the updated progress.
Returns a task that completes when all reported progress has executed.
A task that completes when all progress is complete.
Returns a task that completes when all reported progress has executed.
A cancellation token.
A task that completes when all progress is complete.
Receives a progress update.
The value representing the updated progress.
A collection optimized for usually small number of elements, and items are rarely removed.
Note: this implementation is not thread-safe. It must be protected to prevent race conditions.
The type of elements to be stored.
The single value or array of values stored by this collection.
The number of items.
Adds an element to the collection.
Removes an element from the collection.
Gets the result out of the current list, and reset it to empty.
Make a thread safe copy of the content of this list.
The number of items.
Returns an enumerator for a current snapshot of the collection.
A -aware semaphore that allows reentrancy without consuming another slot in the semaphore.
The factory to wrap all pending and active semaphore requests with to mitigate deadlocks.
The collection of all semaphore holders (and possibly waiters), which waiters should join to mitigate deadlocks.
The underlying semaphore primitive.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
This is private protected so that others cannot derive from this type but we can within the assembly.
Describes ways the may behave when a semaphore request is made in a context that is already in the semaphore.
Reject all requests when the caller has already entered the semaphore
(and not yet exited) by throwing an .
When reentrancy is not expected this is the recommended mode as it will prevent deadlocks
when unexpected reentrancy is detected.
Each request occupies a unique slot in the semaphore.
Reentrancy is not recognized and may lead to deadlocks if the reentrancy level exceeds the count on the semaphore.
This resembles the behavior of the class.
If reentrancy is not in the design, but leads to exceptions due to
ExecutionContext flowing unexpectedly, this mode may be the best option.
A request made by a caller that is already in the semaphore is immediately executed,
and shares the same semaphore slot with its parent.
This nested request must exit before its parent (Strict LIFO/stack behavior).
Exiting the semaphore before a child has or after the parent has will cause an
to fault the returned
from .
When reentrancy is a requirement, this mode helps ensure that reentrancy only happens
where code enters a semaphore, then awaits on other code that itself may enter the semaphore.
When a violation occurs, this semaphore transitions into a faulted state, after which any call
will throw an .
A request made by a caller that is already in the semaphore is immediately executed,
and shares the same semaphore slot with its parent.
The slot is only released when all requests have exited, which may be in any order.
This is the most permissive, but has the highest risk that leaked semaphore access will remain undetected.
Leaked semaphore access is a condition where code is inappropriately considered parented to another semaphore holder,
leading to it being allowed to run code within the semaphore, potentially in parallel with the actual semaphore holder.
Gets the number of openings that remain in the semaphore.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
How to respond to a semaphore request by a caller that has already entered the semaphore.
Executes a given operation within the semaphore.
The delegate to invoke once the semaphore is entered. If a was supplied to the constructor,
this delegate will execute on the main thread if this is invoked on the main thread, otherwise it will be invoked on the
threadpool. When no is supplied to the constructor, this delegate will execute on the
caller's context.
A cancellation token.
A task that completes with the result of , after the semaphore has been exited.
Executes a given operation within the semaphore.
The type of value returned by the operation.
The delegate to invoke once the semaphore is entered. If a was supplied to the constructor,
this delegate will execute on the main thread if this is invoked on the main thread, otherwise it will be invoked on the
threadpool. When no is supplied to the constructor, this delegate will execute on the
caller's context.
A cancellation token.
A task that completes with the result of , after the semaphore has been exited.
Conceals evidence that the caller has entered this till its result is disposed.
A value to dispose to restore visibility of any presence in this semaphore.This method is useful when the caller is about to spin off another operation (e.g. scheduling work to the threadpool)
that it does not consider vital to its own completion, in order to prevent the spun off work from abusing the
caller's right to the semaphore.This is a safe call to make whether or not the semaphore is currently held, or whether reentrancy is allowed on this instance.
Faults all pending semaphore waiters with
and rejects all subsequent attempts to enter the semaphore with the same exception.
Disposes managed and unmanaged resources held by this instance.
if was called; if the object is being finalized.
Throws an exception if this instance has been faulted.
Disposes the specfied release, swallowing certain exceptions.
The releaser to dispose.
Gets a value indicating whether this instance is using Joinable Task aware or not.
Executes the semaphore request.
The delegate that requests the semaphore and executes code within it.
A value for the caller to await on.
Executes the semaphore request.
The delegate that requests the semaphore and executes code within it.
A value for the caller to await on.
A structure that hides any evidence that the caller has entered a till this value is disposed.
The delegate to invoke on disposal.
The instance that is suppressing relevance.
The argument to pass to the delegate.
Initializes a new instance of the struct.
The delegate to invoke on disposal.
The instance that is suppressing relevance.
The argument to pass to the delegate.
An implementation of supporting the mode.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
An implementation of supporting the mode.
The means to recognize that a caller has already entered the semaphore.
We use instead of just here for two reasons:
1. Our own class requires a ref type for the generic type argument.
2. (more importantly) we need all forks of an ExecutionContext to observe updates to the value.
But ExecutionContext is copy-on-write so forks don't see changes to it.
lets us store and later update the boxed value of the existing box reference.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
An implementation of supporting the mode.
The means to recognize that a caller has already entered the semaphore.
We use instead of just here
so that we have a unique identity for each Releaser that we can recognize as a means to verify
the integrity of the "stack" of semaphore reentrant requests.
A flag to indicate this instance was misused and the data it protects should not be touched as it may be corrupted.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
Throws an exception if this instance has been faulted.
An implementation of supporting the mode.
The means to recognize that a caller has already entered the semaphore.
Initializes a new instance of the class.
The initial number of concurrent operations to allow.
The to use to mitigate deadlocks.
The various types of data within a registry key that generate notifications
when changed.
This enum matches the Win32 REG_NOTIFY_CHANGE_* constants.
Notify the caller if a subkey is added or deleted.
Notify the caller of changes to the attributes of the key,
such as the security descriptor information.
Notify the caller of changes to a value of the key. This can
include adding or deleting a value, or changing an existing value.
Notify the caller of changes to the security descriptor of the key.
Exception thrown when a is in a faulted state.
Initializes a new instance of the class.
A single-threaded synchronization context, akin to the DispatcherSynchronizationContext
and WindowsFormsSynchronizationContext.
This must be created on the thread that will serve as the pumping thread.
The list of posted messages to be executed. Must be locked for all access.
The managed thread ID of the thread this instance owns.
Initializes a new instance of the class,
with the new instance affinitized to the current thread.
Initializes a new instance of the class,
as an equivalent copy to another instance.
Pushes a message pump on the current thread that will execute work scheduled using .
The frame to represent this message pump, which controls when the message pump ends.
A message pumping frame that may be pushed with to pump messages
on the owning thread.
The owning sync context.
Backing field for the property.
Gets or sets a value indicating whether a call to with this
should continue pumping messages or should return to its caller.
A structure that applies and reverts changes to the .
A flag indicating whether the non-default constructor was invoked.
The SynchronizationContext to restore when is invoked.
The SynchronizationContext applied when this struct was constructed.
A value indicating whether to check that the applied SyncContext is still the current one when the original is restored.
Initializes a new instance of the struct.
Applies the specified to the caller's context.
The synchronization context to apply.
A value indicating whether to check that the applied SyncContext is still the current one when the original is restored.
Reverts the SynchronizationContext to its previous instance.
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 Acquiring locks on threads with a SynchronizationContext applied is not allowed..
Looks up a localized string similar to A non-upgradeable read lock is held by the caller and cannot be upgraded..
Looks up a localized string similar to Dangerous request for read lock from fork of write lock..
Looks up a localized string similar to This instance must be pushed first..
Looks up a localized string similar to Already transitioned to the Completed state..
Looks up a localized string similar to This operation can only be executed against a valid lock..
Looks up a localized string similar to A lock is required..
Looks up a localized string similar to JoinableTask does not belong to the context this collection was instantiated with..
Looks up a localized string similar to This node already registered..
Looks up a localized string similar to Lazily created value faulted during construction..
Looks up a localized string similar to Lazily created value not yet constructed..
Looks up a localized string similar to This lock has already been marked for completion. No new top-level locks can be serviced..
Looks up a localized string similar to Multiple continuations are not supported..
Looks up a localized string similar to This operation is not allowed while holding an active upgradeable read or write lock from an AsyncReaderWriterLock..
Looks up a localized string similar to Message pump can only be run from the original thread..
Looks up a localized string similar to The queue is empty..
Looks up a localized string similar to Semaphore is already held and reentrancy setting is '{0}'..
Looks up a localized string similar to This semaphore has been misused and can no longer be used..
Looks up a localized string similar to Nested semaphore requests must be released in LIFO order when the reentrancy setting is: '{0}'.
Looks up a localized string similar to This operation cannot be completed on an STA thread..
Looks up a localized string similar to An attempt to switch to the main thread failed to reach the expected thread. Was the JoinableTaskContext initialized on the wrong thread or with a SynchronizationContext whose Post method does not execute its delegate on the main thread?.
Looks up a localized string similar to This frame has already been used with a different instance..
Looks up a localized string similar to No SynchronizationContext to reach the main thread has been set..
Looks up a localized string similar to The value factory has called for the value on the same instance..
Looks up a localized string similar to Write lock out-lived by a nested read lock, which is not allowed..
A -derivative that
does not inline continuations if so configured.
The type of the task's resulting value.
The Task that we expose to others that may not inline continuations.
Initializes a new instance of the class.
to allow continuations to be inlined; otherwise .
TaskCreationOptions to pass on to the base constructor.
The state to set on the Task.
Gets the that may never complete inline with completion of this .
Return the base.Task if it is already completed since inlining continuations
on the completer is no longer a concern. Also, when we are not inlining continuations,
this.exposedTask completes slightly later than base.Task, and callers expect
the Task we return to be complete as soon as they call TrySetResult.
Modifies the specified flags to include RunContinuationsAsynchronously
if wanted by the caller and supported by the platform.
The base options supplied by the caller.
to allow inlining continuations.
The possibly modified flags.
The ETW source for logging events for this library.
We use a fully-descriptive type name because the type name becomes the name
of the ETW Provider.
The singleton instance used for logging.
The event ID for the event.
The event ID for the event.
The event ID for the event.
The event ID for the .
The event ID for the .
The event ID for the .
The event ID for the .
The event ID for the .
The event ID for the .
The event ID for the .
Logs an issued lock.
Logs a wait for a lock.
Logs a lock that was issued after a contending lock was released.
Enters a synchronously task.
Hash code of the task.
Whether the task is on the main thread.
Exits a synchronously task.
Hash code of the task.
The current thread starts to wait on execution requests.
The current thread gets an execution request.
Post a execution request to the queue.
The request id.
The execution need happen on the main thread.
An execution request is processed.
The request id.
Circular JoinableTask dependency detected.
Initial count of unreachable nodes.
The size of the connected dependency graph.
The names of constants in this class make up the middle term in
the AsyncReaderWriterLock/LockRequest/Issued event name.
The name of this class is important for EventSource.
The names of constants in this class make up the last term in
the AsyncReaderWriterLock/LockRequest/Issued event name.
The name of this class is important for EventSource.
Utility methods for working across threads.
Optimistically performs some value transformation based on some field and tries to apply it back to the field,
retrying as many times as necessary until no other thread is manipulating the same field.
The type of data.
The field that may be manipulated by multiple threads.
A function that receives the unchanged value and returns the changed value.
if the location's value is changed by applying the result of the function;
if the location's value remained the same because the last invocation of returned the existing value.
Optimistically performs some value transformation based on some field and tries to apply it back to the field,
retrying as many times as necessary until no other thread is manipulating the same field.
Use this overload when requires a single item, as is common when updating immutable
collection types. By passing the item as a method operand, the caller may be able to avoid allocating a closure
object for every call.
The type of data to apply the change to.The type of argument passed to the .
The field that may be manipulated by multiple threads.
An argument to pass to .
A function that receives both the unchanged value and , then returns the changed value.
if the location's value is changed by applying the result of the function;
if the location's value remained the same because the last invocation of returned the existing value.
Wraps a task with one that will complete as cancelled based on a cancellation token,
allowing someone to await a task but be able to break out early by cancelling the token.
The type of value returned by the task.
The task to wrap.
The token that can be canceled to break out of the await.
The wrapping task.
Wraps a task with one that will complete as cancelled based on a cancellation token,
allowing someone to await a task but be able to break out early by cancelling the token.
The task to wrap.
The token that can be canceled to break out of the await.
The wrapping task.
Applies the specified to the caller's context.
The synchronization context to apply.
A value indicating whether to check that the applied SyncContext is still the current one when the original is restored.
Wraps a task with one that will complete as cancelled based on a cancellation token,
allowing someone to await a task but be able to break out early by cancelling the token.
The task to wrap.
A value indicating whether *internal* continuations required to respond to cancellation should run on the current .
The token that can be canceled to break out of the await.
The wrapping task.
Cancels a if a given is canceled.
The type of value returned by a successfully completed .
The to cancel.
The .
A callback to invoke when cancellation occurs.
Wraps a task with one that will complete as cancelled based on a cancellation token,
allowing someone to await a task but be able to break out early by cancelling the token.
The type of value returned by the task.
The task to wrap.
The token that can be canceled to break out of the await.
The wrapping task.
Wraps a task with one that will complete as cancelled based on a cancellation token,
allowing someone to await a task but be able to break out early by cancelling the token.
The task to wrap.
A value indicating whether *internal* continuations required to respond to cancellation should run on the current .
The token that can be canceled to break out of the await.
The wrapping task.
A state object for tracking cancellation and a TaskCompletionSource.
The type of value returned from a task.
We use this class so that we only allocate one object to support all continuations
required for cancellation handling, rather than a special closure and delegate for each one.
The ID of the thread on which this instance was created.
Initializes a new instance of the class.
The task completion source.
A callback to invoke when cancellation occurs.
The cancellation token.
Gets the cancellation token.
Gets the Task completion source.
Gets or sets the cancellation token registration.
Gets or sets a value indicating whether the continuation has been scheduled (and not run inline).
Gets a value indicating whether the caller is on the same thread as the one that created this instance.
Extensions to the Task Parallel Library.
A singleton completed task.
A task that is already canceled.
A completed task with a result.
A completed task with a result.
Wait on a task without possibly inlining it to the current thread.
The task to wait on.
Returns a task that completes as the original task completes or when a timeout expires,
whichever happens first.
The task to wait for.
The maximum time to wait.
A task that completes with the result of the specified or
faults with a if elapses first.
Returns a task that completes as the original task completes or when a timeout expires,
whichever happens first.
The type of value returned by the original task.
The task to wait for.
The maximum time to wait.
A task that completes with the result of the specified or
faults with a if elapses first.
Applies one task's results to another.
The type of value returned by a task.
The task whose completion should be applied to another.
The task that should receive the completion status.
Applies one task's results to another.
The type of value returned by a task.
The task whose completion should be applied to another.
The task that should receive the completion status.
Creates a task that is attached to the parent task, but produces the same result as an existing task.
The type of value produced by the task.
The task to wrap with an AttachedToParent task.
A task that is attached to parent.
Creates a task that is attached to the parent task, but produces the same result as an existing task.
The task to wrap with an AttachedToParent task.
A task that is attached to parent.
Schedules some action for execution at the conclusion of a task, regardless of the task's outcome.
The task that should complete before the posted is invoked.
The action to execute after has completed.
The task continuation options to apply.
The cancellation token that signals the continuation should not execute (if it has not already begun).
The task that will execute the action.
Gets a task that will eventually produce the result of another task, when that task finishes.
If that task is instead canceled, its successor will be followed for its result, iteratively.
The type of value returned by the task.
The task whose result should be returned by the following task.
A token whose cancellation signals that the following task should be cancelled.
The TaskCompletionSource whose task is to follow. Leave at for a new task to be created.
The following task.
Returns an awaitable for the specified task that will never throw, even if the source task
faults or is canceled.
The task whose completion should signal the completion of the returned awaitable.
if set to the continuation will be scheduled on the caller's context; to always execute the continuation on the threadpool.
An awaitable.
Returns an awaitable for the specified task that will never throw, even if the source task
faults or is canceled.
The task whose completion should signal the completion of the returned awaitable.
if set to the continuation will be scheduled on the caller's context; to always execute the continuation on the threadpool.
An awaitable.
Returns an awaitable for the specified task that will never throw, even if the source task
faults or is canceled.
The awaitable returned by this method does not provide access to the result of a successfully-completed
. To await without throwing and use the resulting value, the following
pattern may be used:
var methodValueTask = MethodAsync().Preserve();
await methodValueTask.NoThrowAwaitable(true);
if (methodValueTask.IsCompletedSuccessfully)
{
var result = methodValueTask.Result;
}
else
{
var exception = methodValueTask.AsTask().Exception.InnerException;
}
The task whose completion should signal the completion of the returned awaitable.
if set to the continuation will be scheduled on the caller's context; to always execute the continuation on the threadpool.
An awaitable.The type of the result.
Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to async methods within async methods.
The task whose result is to be ignored.
Consumes a and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods.
NOTE: APIs should not generally return if callers aren't 99.9999% likely to await the result immediately.
The task whose result is to be ignored.
Consumes a ValueTask and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods.
NOTE: APIs should not generally return if callers aren't 99.9999% likely to await the result immediately.
The type of value produced by the .
The task whose result is to be ignored.
Invokes asynchronous event handlers, returning a task that completes when all event handlers have been invoked.
Each handler is fully executed (including continuations) before the next handler in the list is invoked.
The event handlers. May be .
The event source.
The event argument.
The task that completes when all handlers have completed.Thrown if any handlers fail. It contains a collection of all failures.
Invokes asynchronous event handlers, returning a task that completes when all event handlers have been invoked.
Each handler is fully executed (including continuations) before the next handler in the list is invoked.
The type of argument passed to each handler.
The event handlers. May be .
The event source.
The event argument.
The task that completes when all handlers have completed. The task is faulted if any handlers throw an exception.Thrown if any handlers fail. It contains a collection of all failures.
Converts a TPL task to the APM Begin-End pattern.
The result value to be returned from the End method.
The task that came from the async method.
The optional callback to invoke when the task is completed.
The state object provided by the caller of the Begin method.
A task (that implements that should be returned from the Begin method.
Converts a TPL task to the APM Begin-End pattern.
The task that came from the async method.
The optional callback to invoke when the task is completed.
The state object provided by the caller of the Begin method.
A task (that implements that should be returned from the Begin method.
Creates a TPL Task that returns when a is signaled or returns if a timeout occurs first.
The handle whose signal triggers the task to be completed. Do not use a here.
The timeout (in milliseconds) after which the task will return if the handle is not signaled by that time.
A token whose cancellation will cause the returned Task to immediately complete in a canceled state.
A Task that completes when the handle is signaled or times out, or when the caller's cancellation token is canceled.
If the task completes because the handle is signaled, the task's result is .
If the task completes because the handle is not signaled prior to the timeout, the task's result is .
The completion of the returned task is asynchronous with respect to the code that actually signals the wait handle.
Applies one task's results to another.
The type of value returned by a task.
The task whose completion should be applied to another.
The task that should receive the completion status.
to complete the supplied as efficiently as possible (inline with the completion of );
to complete the asynchronously.
Note if is completed when this method is invoked, then is always completed synchronously.
Returns a reusable task that is already canceled.
The type parameter for the returned task.
Returns a that has been faulted with the specified exception.
The type of value that might have been returned from the .
The exception used to fault the .
The faulted task.
Applies a completed task's results to another.
The type of value returned by a task.
The task whose completion should be applied to another.
The task that should receive the completion status.
Applies a completed task's results to another.
The type of value returned by a task.
The task whose completion should be applied to another.
The task that should receive the completion status.
The value to set on the completion source when the source task runs to completion.
Gets a task that will eventually produce the result of another task, when that task finishes.
If that task is instead canceled, its successor will be followed for its result, iteratively.
The type of value returned by the task.
The TaskCompletionSource whose task is to follow.
The current task.
The following task.
An awaitable that wraps a task and never throws an exception when waited on.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
Whether the continuation should be scheduled on the current sync context.
Gets the awaiter.
The awaiter.
An awaiter that wraps a task and never throws an exception when waited on.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
if set to [capture context].
Gets a value indicating whether the task has completed.
Schedules a delegate for execution at the conclusion of a task's execution.
The action.
Schedules a delegate for execution at the conclusion of a task's execution
without capturing the ExecutionContext.
The action.
Does nothing.
An awaitable that wraps a task and never throws an exception when waited on.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
Whether the continuation should be scheduled on the current sync context.
Gets the awaiter.
The awaiter.
An awaiter that wraps a task and never throws an exception when waited on.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
if set to [capture context].
Gets a value indicating whether the task has completed.
Schedules a delegate for execution at the conclusion of a task's execution.
The action.
Schedules a delegate for execution at the conclusion of a task's execution
without capturing the ExecutionContext.
The action.
Does nothing.
An awaitable that wraps a and never throws an exception when waited on.
The type of the result.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
Whether the continuation should be scheduled on the current sync context.
Gets the awaiter.
The awaiter.
An awaiter that wraps a task and never throws an exception when waited on.
The type of the result.
The task.
A value indicating whether the continuation should be scheduled on the current sync context.
Initializes a new instance of the struct.
The task.
if set to [capture context].
Gets a value indicating whether the task has completed.
Schedules a delegate for execution at the conclusion of a task's execution.
The action.
Schedules a delegate for execution at the conclusion of a task's execution
without capturing the ExecutionContext.
The action.
Does nothing.
A state bag for the method.
The type of value ultimately returned.
The delegate that returns the task to follow.
Initializes a new instance of the struct.
The get task to follow.
The cancellation token.
Initializes a new instance of the struct.
The get task to follow.
The cancellation token registration to dispose of when the task completes normally.
The cancellation token.
Gets the ultimate cancellation token.
Gets the cancellation token registration to dispose of when the task completes normally.
Gets the current task to follow.
A cache for canceled instances.
The type parameter for the returned task.
A task that is already canceled.
A task completion source that contains additional state.
The type of the state.The type of the result.
Initializes a new instance of the class.
The state to store in the property.
State of the task.
The options.
Gets or sets the state passed into the constructor.
Dictionary that does not prevent keys from being garbage collected.
Type of key, without the WeakReference wrapper.Type of value.
See also Microsoft.Build.Collections.WeakDictionary.
The dictionary used internally to store the keys and values.
The key comparer to use for hashing and equality checks.
The dictionary's initial capacity, and the capacity beyond which we will resist to grow
by scavenging for collected keys first.
Initializes a new instance of the class.
The key comparer to use. A value indicates the default comparer will be used.
The initial capacity of the dictionary. Growth beyond this capacity will first induce a scavenge operation.
Gets the number of entries in this dictionary.
Some entries may represent keys or values that have already been garbage collected.
To clean these out call .
Gets all key values in the dictionary.
Obtains the value for a given key.
Whether there is a key present with the specified key.
As usual, don't just call Contained as the wrapped value may be null.
Attempts to get the value for the provided key.
Returns true if the key is found, otherwise false.
Removes an entry with the specified key.
Returns true if found, false otherwise.
Remove any entries from the dictionary that represent keys
that have been garbage collected.
The number of entries removed.
Empty the collection.
See IEnumerable<T>.
See IEnumerable<T>.
See IEnumerable.
Whether the collection contains any item.
Strongly typed wrapper around a weak reference that caches
the target's hash code so that it can be used in a hashtable.
Type of the target of the weak reference.
Cache the hashcode so that it is still available even if the target has been
collected. This allows this object to be still found in a table so it can be removed.
Backing weak reference.
Some of the instances are around just to do existence checks, and don't want
to allocate WeakReference objects as they are short-lived.
Initializes a new instance of the struct.
Gets the target wrapped by this weak reference. Null if the target has already been garbage collected.
Gets a value indicating whether the target has not been garbage collected yet.
Returns the hashcode of the wrapped target.
Compares two structures.
A helper structure to implement .
Gets the current item of the enumerator.
Implements .
A helper structure to enumerate keys in the dictionary.
Implements .
Implements .
Gets the Enumerator.
A new KeyEnumerator.
Equality comparer for weak references that actually compares the
targets of the weak references.
Type of the targets of the weak references to be compared.
Comparer to use if specified, otherwise null.
Initializes a new instance of the class
with an explicitly specified comparer.
May be null, in which case the default comparer for the type will be used.
Gets the hashcode.
Compares the weak references for equality.
Contains extern methods from "ADVAPI32.dll".
Contains extern methods from "KERNEL32.dll".
Closes a handle to the specified registry key.A handle to the open key to be closed. The handle must have been opened by the RegCreateKeyEx, RegCreateKeyTransacted, RegOpenKeyEx, RegOpenKeyTransacted, or RegConnectRegistry function.Read more on docs.microsoft.com.If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.Learn more about this API from docs.microsoft.com.Notifies the caller about changes to the attributes or contents of a specified registry key.A handle to an open registry key. This handle is returned by the RegCreateKeyEx or RegOpenKeyEx function. It can also be one of the following predefined keys:HKEY_CLASSES_ROOTHKEY_CURRENT_CONFIGHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS This parameter must be a local handle. If RegNotifyChangeKeyValue is called with a remote handle, it returns ERROR_INVALID_HANDLE. The key must have been opened with the KEY_NOTIFY access right. For more information, see Registry Key Security and Access Rights.Read more on docs.microsoft.com.
If this parameter is TRUE, the function reports changes in the specified key and its subkeys. If the parameter is FALSE, the function reports changes only in the specified key.
A handle to an event. If the fAsynchronous parameter is TRUE, the function returns immediately and changes are reported by signaling this event. If fAsynchronous is FALSE, hEvent is ignored.
If this parameter is TRUE, the function returns immediately and reports changes by signaling the specified event. If this parameter is FALSE, the function does not return until a change has occurred.If hEvent does not specify a valid event, the fAsynchronous parameter cannot be TRUE.Read more on docs.microsoft.com.If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.Learn more about this API from docs.microsoft.com.Closes an open object handle.
A valid handle to an open object.
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function.Learn more about this API from docs.microsoft.com.Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses.
The number of object handles in the array pointed to by lpHandles. The maximum number of object handles is MAXIMUM_WAIT_OBJECTS. This parameter cannot be zero.
An array of object handles. For a list of the object types whose handles can be specified, see the following Remarks section. The array can contain handles to objects of different types. It may not contain multiple copies of the same handle. If one of these handles is closed while the wait is still pending, the function's behavior is undefined. The handles must have the SYNCHRONIZE access right. For more information, see Standard Access Rights.Read more on docs.microsoft.com.
If this parameter is TRUE, the function returns when the state of all objects in the lpHandles array is signaled. If FALSE, the function returns when the state of any one of the objects is set to signaled. In the latter case, the return value indicates the object whose state caused the function to return.
The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the specified objects are signaled or the interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the specified objects are not signaled; it always returns immediately. If dwMilliseconds is INFINITE, the function will return only when the specified objects are signaled. Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2: The dwMilliseconds value does include time spent in low-power states. For example, the timeout does keep counting down while the computer is asleep. Windows 8, Windows Server 2012, Windows 8.1, Windows Server 2012 R2, Windows 10 and Windows Server 2016: The dwMilliseconds value does not include time spent in low-power states. For example, the timeout does not keep counting down while the computer is asleep.Read more on docs.microsoft.com.If the function succeeds, the return value indicates the event that caused the function to return. It can be one of the following values. (Note that WAIT_OBJECT_0 is defined as 0 and WAIT_ABANDONED_0 is defined as 0x00000080L.) This doc was truncated.Learn more about this API from docs.microsoft.com.Lvek4kKFCrTViMhUzgVEmA6UFsj+DA24jPh4a/1UGw4=Xdz8Z95KnZLvlBP1Aa55z3OzIDv6Y+1CrMBgrWPVXdXpNMiXM6aJif+vufTXmBahrzrcB43Z7CJwPT3+Vgyk73CnBX+5Bi4FsMl9NtekOtddbNIxJQi08lSVHSWh3KEDBJLZPZ9kmZA1yhyHGCG/Kw/2CAqd99IMDJO9k4RDCqr9ZDj/H6/ehQ+vVAmoBGs+IiattlURouuuqazrEGoR6h9/dwpjB0W6ErOYwc7U6KjulC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