Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ WriteAsync()

override ValueTask System.Threading.Channels.SingleConsumerUnboundedChannel< T >.UnboundedChannelWriter.WriteAsync ( T item,
CancellationToken cancellationToken )
inlinevirtual

Reimplemented from System.Threading.Channels.ChannelWriter< T >.

Definition at line 267 of file SingleConsumerUnboundedChannel.cs.

268 {
269 if (!cancellationToken.IsCancellationRequested)
270 {
271 if (!TryWrite(item))
272 {
273 return new ValueTask(Task.FromException(ChannelUtilities.CreateInvalidCompletionException(_parent._doneWriting)));
274 }
275 return default(ValueTask);
276 }
278 }
static Task FromException(Exception exception)
Definition Task.cs:3341
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363

References System.Threading.Channels.SingleConsumerUnboundedChannel< T >.UnboundedChannelWriter._parent, System.cancellationToken, System.Threading.Channels.ChannelUtilities.CreateInvalidCompletionException(), System.Threading.Tasks.Task< TResult >.FromCanceled(), System.Threading.Tasks.Task< TResult >.FromException(), System.item, and System.Threading.Channels.SingleConsumerUnboundedChannel< T >.UnboundedChannelWriter.TryWrite().