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

◆ DequeueItemAndPostProcess()

T System.Threading.Channels.BoundedChannel< T >.BoundedChannelReader.DequeueItemAndPostProcess ( )
inlineprivate

Definition at line 143 of file BoundedChannel.cs.

144 {
145 BoundedChannel<T> parent = _parent;
146 T result = parent._items.DequeueHead();
147 if (parent._doneWriting != null)
148 {
149 if (parent._items.IsEmpty)
150 {
151 ChannelUtilities.Complete(parent._completion, parent._doneWriting);
152 }
153 }
154 else
155 {
156 while (!parent._blockedWriters.IsEmpty)
157 {
158 VoidAsyncOperationWithData<T> voidAsyncOperationWithData = parent._blockedWriters.DequeueHead();
159 if (voidAsyncOperationWithData.TrySetResult(default(VoidResult)))
160 {
161 parent._items.EnqueueTail(voidAsyncOperationWithData.Item);
162 return result;
163 }
164 }
165 ChannelUtilities.WakeUpWaiters(ref parent._waitingWritersTail, result: true);
166 }
167 return result;
168 }

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

Referenced by System.Threading.Channels.BoundedChannel< T >.BoundedChannelReader.ReadAsync(), and System.Threading.Channels.BoundedChannel< T >.BoundedChannelReader.TryRead().