System.Threading.Channels An empty struct, used to represent void in generic types. Provides a double-ended queue data structure. Type of the data stored in the dequeue. Provides a producer/consumer queue safe to be used by only one producer and one consumer concurrently. Specifies the type of data contained in the queue. The initial size to use for segments (in number of elements). The maximum size to use for segments (in number of elements). The head of the linked list of segments. The tail of the linked list of segments. Initializes the queue. Enqueues an item into the queue. The item to enqueue. Enqueues an item into the queue. The item to enqueue. The segment in which to first attempt to store the item. Attempts to dequeue an item from the queue. The dequeued item. true if an item could be dequeued; otherwise, false. Attempts to dequeue an item from the queue. The array from which the item was dequeued. The segment from which the item was dequeued. The dequeued item. true if an item could be dequeued; otherwise, false. Gets whether the collection is currently empty. Gets an enumerable for the collection. This method is not safe to use concurrently with any other members that may mutate the collection. Gets the number of items in the collection. This method is not safe to use concurrently with any other members that may mutate the collection. A segment in the queue containing one or more items. The next segment in the linked list of segments. The data stored in this segment. Details about the segment. Initializes the segment. The size to use for this segment. Stores information about a segment. Padding to reduce false sharing between the segment's array and _first. The index of the current head in the segment. A copy of the current tail index. Padding to reduce false sharing between the first and last. A copy of the current head index. The index of the current tail in the segment. Padding to reduce false sharing with the last and what's after the segment. Debugger type proxy for a SingleProducerSingleConsumerQueue of T. The queue being visualized. Initializes the debug view. The queue being debugged. Gets the contents of the list. A placeholder class for common padding constants and eventually routines. A size greater than or equal to the size of the most common CPU cache lines. Padding structure used to minimize false sharing in SingleProducerSingleConsumerQueue{T}. Provides a channel with a bounded capacity. The mode used when the channel hits its bound. Task signaled when the channel has completed. The maximum capacity of the channel. Items currently stored in the channel waiting to be read. Readers waiting to read from the channel. Writers waiting to write to the channel. Linked list of WaitToReadAsync waiters. Linked list of WaitToWriteAsync waiters. Whether to force continuations to be executed asynchronously from producer writes. Set to non-null once Complete has been called. Gets an object used to synchronize all state on the instance. Initializes the . The positive bounded capacity for the channel. The mode used when writing to a full channel. Whether to force continuations to be executed asynchronously. Dequeues an item, and then fixes up our state around writers and completion. The dequeued item. Gets the number of items in the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the number of items in the channel. This should only be used by the debugger. Gets the capacity of the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the number of items in the channel. This should only be used by the debugger. Report if the channel is closed or not. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Specifies the behavior to use when writing to a bounded channel that is already full. Wait for space to be available in order to complete the write operation. Remove and ignore the newest item in the channel in order to make room for the item being written. Remove and ignore the oldest item in the channel in order to make room for the item being written. Drop the item being written. Provides static methods for creating channels. Creates an unbounded channel usable by any number of readers and writers concurrently. The created channel. Creates an unbounded channel subject to the provided options. Specifies the type of data in the channel. Options that guide the behavior of the channel. The created channel. Creates a channel with the specified maximum capacity. Specifies the type of data in the channel. The maximum number of items the channel may store. The created channel. Channels created with this method apply the behavior and prohibit continuations from running synchronously. Creates a channel with the specified maximum capacity. Specifies the type of data in the channel. Options that guide the behavior of the channel. The created channel. Exception thrown when a channel is used after it's been closed. Initializes a new instance of the class. Initializes a new instance of the class. The message that describes the error. Initializes a new instance of the class. The exception that is the cause of this exception. Initializes a new instance of the class. The message that describes the error. The exception that is the cause of this exception. Provides options that control the behavior of channel instances. true if writers to the channel guarantee that there will only ever be at most one write operation at a time; false if no such constraint is guaranteed. If true, the channel may be able to optimize certain operations based on knowing about the single-writer guarantee. The default is false. true readers from the channel guarantee that there will only ever be at most one read operation at a time; false if no such constraint is guaranteed. If true, the channel may be able to optimize certain operations based on knowing about the single-reader guarantee. The default is false. true if operations performed on a channel may synchronously invoke continuations subscribed to notifications of pending async operations; false if all continuations should be invoked asynchronously. Setting this option to true can provide measurable throughput improvements by avoiding scheduling additional work items. However, it may come at the cost of reduced parallelism, as for example a producer may then be the one to execute work associated with a consumer, and if not done thoughtfully, this can lead to unexpected interactions. The default is false. Provides options that control the behavior of instances. The maximum number of items the bounded channel may store. The behavior incurred by write operations when the channel is full. Initializes the options. The maximum number of items the bounded channel may store. Gets or sets the maximum number of items the bounded channel may store. Gets or sets the behavior incurred by write operations when the channel is full. Provides options that control the behavior of instances. Provides a base class for reading from a channel. Specifies the type of data that may be read from the channel. Gets a that completes when no more data will ever be available to be read from this channel. Attempts to read an item to the channel. The read item, or a default value if no item could be read. true if an item was read; otherwise, false if no item was read. Returns a that will complete when data is available to read. A used to cancel the wait operation. A that will complete with a true result when data is available to read or with a false result when no further data will ever be available to be read. Asynchronously reads an item from the channel. A used to cancel the read operation. A that represents the asynchronous read operation. Provides internal helper methods for implementing channels. Sentinel object used to indicate being done writing. A cached task with a Boolean true result. A cached task with a Boolean false result. A cached task that never completes. Completes the specified TaskCompletionSource. The source to complete. The optional exception with which to complete. If this is null or the DoneWritingSentinel, the source will be completed successfully. If this is an OperationCanceledException, it'll be completed with the exception's token. Otherwise, it'll be completed as faulted with the exception. Gets a value task representing an error. Specifies the type of the value that would have been returned. The error. This may be . The failed task. Removes all operations from the queue, failing each. The queue of operations to complete. The error with which to complete each operations. Creates and returns an exception object to indicate that a channel has been closed. Provides a base class for writing to a channel. Specifies the type of data that may be written to the channel. Attempts to mark the channel as being completed, meaning no more data will be written to it. An indicating the failure causing no more data to be written, or null for success. true if this operation successfully completes the channel; otherwise, false if the channel could not be marked for completion, for example due to having already been marked as such, or due to not supporting completion. Attempts to write the specified item to the channel. The item to write. true if the item was written; otherwise, false if it wasn't written. Returns a that will complete when space is available to write an item. A used to cancel the wait operation. A that will complete with a true result when space is available to write an item or with a false result when no further writing will be permitted. Asynchronously writes an item to the channel. The value to write to the channel. A used to cancel the write operation. A that represents the asynchronous write operation. Mark the channel as being complete, meaning no more items will be written to it. Optional Exception indicating a failure that's causing the channel to complete. The channel has already been marked as complete. Provides a base class for channels that support reading and writing elements of type . Specifies the type of data readable and writable in the channel. Provides a base class for channels that support reading elements of type and writing elements of type . Specifies the type of data that may be written to the channel. Specifies the type of data that may be read from the channel. Gets the readable half of this channel. Gets the writable half of this channel. Implicit cast from a channel to its readable half. The channel being cast. Implicit cast from a channel to its writable half. The channel being cast. Sentinel object used in a field to indicate the operation is available for use. Sentinel object used in a field to indicate the operation has completed. Throws an exception indicating that the operation's result was accessed before the operation completed. Throws an exception indicating that multiple continuations can't be set for the same operation. Throws an exception indicating that the operation was used after it was supposed to be used. The representation of an asynchronous operation that has a result value. Specifies the type of the result. May be . Registration with a provided cancellation token. true if this object is pooled and reused; otherwise, false. If the operation is cancelable, then it can't be pooled. And if it's poolable, there must never be race conditions to complete it, which is the main reason poolable objects can't be cancelable, as then cancellation could fire, the object could get reused, and then we may end up trying to complete an object that's used by someone else. Whether continuations should be forced to run asynchronously. Only relevant to cancelable operations; 0 if the operation hasn't had completion reserved, 1 if it has. The result of the operation. Any error that occurred during the operation. The continuation callback. This may be the completion sentinel if the operation has already completed. This may be the available sentinel if the operation is being pooled and is available for use. This may be null if the operation is pending. This may be another callback if the operation has had a callback hooked up with OnCompleted. State object to be passed to . Scheduling context (a or ) to which to queue the continuation. May be null. Execution context to use when invoking . May be null. The token value associated with the current operation. IValueTaskSource operations on this instance are only valid if the provided token matches this value, which is incremented once GetResult is called to avoid multiple awaits on the same instance. Initializes the interactor. true if continuations should be forced to run asynchronously; otherwise, false. The cancellation token used to cancel the operation. Whether this instance is pooled and reused. Gets or sets the next operation in the linked list of operations. Gets the cancellation token associated with this operation. Gets a backed by this instance and its current token. Gets a backed by this instance and its current token. Gets the current status of the operation. The token that must match . Gets whether the operation has completed. The operation is considered completed if both a) it's in the completed state, AND b) it has a non-null continuation. We need to consider both because they're not set atomically. If we only considered the state, then if we set the state to completed and then set the continuation, it's possible for an awaiter to check IsCompleted, see true, call GetResult, and return the object to the pool, and only then do we try to store the continuation into an object we no longer own. If we only considered the state, then if we set the continuation and then set the state, a racing awaiter could see the continuation set before the state has transitioned to completed and could end up calling GetResult in an incomplete state. And if we only considered the continuation, then we have issues if OnCompleted is used before the operation completes, as the continuation will be Gets the result of the operation. The token that must match . Gets the result of the operation. The token that must match . Attempts to take ownership of the pooled instance. true if the instance is now owned by the caller, in which case its state has been reset; otherwise, false. Hooks up a continuation callback for when the operation has completed. The callback. The state to pass to the callback. The current token that must match . Flags that influence the behavior of the callback. Unregisters from cancellation. This is important for two reasons: 1. To avoid leaking a registration into a token, so it must be done prior to completing the operation. 2. To avoid having to worry about concurrent completion; once invoked, the caller can be guaranteed that no one else will try to complete the operation (assuming the caller is properly constructed and themselves guarantees only a single completer other than through cancellation). Completes the operation with a success state and the specified result. The result value. true if the operation could be successfully transitioned to a completed state; false if it was already completed. Completes the operation with a failed state and the specified error. The error. true if the operation could be successfully transitioned to a completed state; false if it was already completed. Completes the operation with a failed state and a cancellation error. The cancellation token that caused the cancellation. true if the operation could be successfully transitioned to a completed state; false if it was already completed. Attempts to reserve this instance for completion. This will always return true for non-cancelable objects, as they only ever have a single owner responsible for completion. For cancelable operations, this will attempt to atomically transition from Initialized to CompletionReserved. Signals to a registered continuation that the operation has now completed. Invokes the registered continuation; separated out of SignalCompletion for convenience so that it may be invoked on multiple code paths. The representation of an asynchronous operation that has a result value and carries additional data with it. Specifies the type of data being written. Initializes the interactor. true if continuations should be forced to run asynchronously; otherwise, false. The cancellation token used to cancel the operation. Whether this instance is pooled and reused. The item being written. Provides a buffered channel of unbounded capacity for use by any number of writers but at most a single reader at a time. Task that indicates the channel has completed. A concurrent queue to hold the items for this channel. The queue itself supports at most one writer and one reader at a time; as a result, since this channel supports multiple writers, all write access to the queue must be synchronized by the channel. Whether to force continuations to be executed asynchronously from producer writes. non-null if the channel has been marked as complete for writing. An if there's a blocked reader. A waiting reader (e.g. WaitForReadAsync) if there is one. Initialize the channel. Whether to force continuations to be executed asynchronously. Gets the number of items in the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the number of items in the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the number of items in the channel. This should only be used by the debugger. Report if the channel is closed or not. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Provides a buffered channel of unbounded capacity. Task that indicates the channel has completed. The items in the channel. Readers blocked reading from the channel. Whether to force continuations to be executed asynchronously from producer writes. Readers waiting for a notification that data is available. Set to non-null once Complete has been called. Initialize the channel. Gets the number of items in the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the number of items in the channel. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel. Gets the object used to synchronize access to all state on this instance. Gets the number of items in the channel. This should only be used by the debugger. Report if the channel is closed or not. This should only be used by the debugger. Gets an enumerator the debugger can use to show the contents of the channel.