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

◆ TryComplete() [1/2]

override bool System.Threading.Channels.UnboundedChannel< T >.UnboundedChannelWriter.TryComplete ( Exception error)
inline

Definition at line 156 of file UnboundedChannel.cs.

157 {
159 bool isEmpty;
160 lock (parent.SyncObj)
161 {
162 if (parent._doneWriting != null)
163 {
164 return false;
165 }
166 parent._doneWriting = error ?? ChannelUtilities.s_doneWritingSentinel;
167 isEmpty = parent._items.IsEmpty;
168 }
169 if (isEmpty)
170 {
171 ChannelUtilities.Complete(parent._completion, error);
172 }
173 ChannelUtilities.FailOperations<AsyncOperation<T>, T>(parent._blockedReaders, ChannelUtilities.CreateInvalidCompletionException(error));
174 ChannelUtilities.WakeUpWaiters(ref parent._waitingReadersTail, result: false, error);
175 return true;
176 }

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