Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryComplete() [1/2]

override bool System.Threading.Channels.BoundedChannel< T >.BoundedChannelWriter.TryComplete ( Exception error)
inline

Definition at line 197 of file BoundedChannel.cs.

198 {
199 BoundedChannel<T> parent = _parent;
200 bool isEmpty;
201 lock (parent.SyncObj)
202 {
203 if (parent._doneWriting != null)
204 {
205 return false;
206 }
207 parent._doneWriting = error ?? ChannelUtilities.s_doneWritingSentinel;
208 isEmpty = parent._items.IsEmpty;
209 }
210 if (isEmpty)
211 {
212 ChannelUtilities.Complete(parent._completion, error);
213 }
214 ChannelUtilities.FailOperations<AsyncOperation<T>, T>(parent._blockedReaders, ChannelUtilities.CreateInvalidCompletionException(error));
215 ChannelUtilities.FailOperations<VoidAsyncOperationWithData<T>, VoidResult>(parent._blockedWriters, ChannelUtilities.CreateInvalidCompletionException(error));
216 ChannelUtilities.WakeUpWaiters(ref parent._waitingReadersTail, result: false, error);
217 ChannelUtilities.WakeUpWaiters(ref parent._waitingWritersTail, result: false, error);
218 return true;
219 }

References System.Threading.Channels.BoundedChannel< T >.BoundedChannelWriter._parent, System.Threading.Channels.ChannelUtilities.Complete(), System.Threading.Channels.ChannelUtilities.CreateInvalidCompletionException(), System.Threading.Channels.ChannelUtilities.s_doneWritingSentinel, and System.Threading.Channels.ChannelUtilities.WakeUpWaiters().