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

◆ MoveNextSlowPath()

bool System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >.MoveNextSlowPath ( )
inlineprivate

Definition at line 55 of file AsynchronousChannelMergeEnumerator.cs.

56 {
57 int num = 0;
58 int num2 = _channelIndex;
59 int channelIndex;
60 while ((channelIndex = _channelIndex) != _channels.Length)
61 {
62 AsynchronousChannel<T> asynchronousChannel = _channels[channelIndex];
63 bool flag = _done[channelIndex];
64 if (!flag && asynchronousChannel.TryDequeue(ref _currentElement))
65 {
66 _channelIndex = (channelIndex + 1) % _channels.Length;
67 return true;
68 }
69 if (!flag && asynchronousChannel.IsDone)
70 {
71 if (!asynchronousChannel.IsChunkBufferEmpty)
72 {
73 bool flag2 = asynchronousChannel.TryDequeue(ref _currentElement);
74 return true;
75 }
76 _done[channelIndex] = true;
77 flag = true;
78 asynchronousChannel.Dispose();
79 }
80 if (flag && ++num == _channels.Length)
81 {
82 channelIndex = (_channelIndex = _channels.Length);
83 break;
84 }
85 channelIndex = (_channelIndex = (channelIndex + 1) % _channels.Length);
86 if (channelIndex != num2)
87 {
88 continue;
89 }
90 try
91 {
92 num = 0;
93 for (int i = 0; i < _channels.Length; i++)
94 {
95 bool isDone = false;
96 if (!_done[i] && _channels[i].TryDequeue(ref _currentElement, ref isDone))
97 {
98 return true;
99 }
100 if (isDone)
101 {
102 if (!_done[i])
103 {
104 _done[i] = true;
105 }
106 if (++num == _channels.Length)
107 {
108 channelIndex = (_channelIndex = _channels.Length);
109 break;
110 }
111 }
112 }
113 if (channelIndex == _channels.Length)
114 {
115 break;
116 }
118 channelIndex = (_channelIndex = _consumerEvent.Value);
120 num2 = channelIndex;
121 num = 0;
122 continue;
123 }
124 finally
125 {
126 for (int j = 0; j < _channels.Length; j++)
127 {
128 if (!_done[j])
129 {
130 _channels[j].DoneWithDequeueWait();
131 }
132 }
133 }
134 }
135 _taskGroupState.QueryEnd(userInitiatedDispose: false);
136 return false;
137 }
void QueryEnd(bool userInitiatedDispose)

References System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >._channelIndex, System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >._channels, System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >._consumerEvent, System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >._currentElement, System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >._done, System.Linq.Parallel.MergeEnumerator< T >._taskGroupState, System.Linq.Parallel.AsynchronousChannel< T >.Dispose(), System.Linq.Parallel.AsynchronousChannel< T >.IsChunkBufferEmpty, System.Linq.Parallel.AsynchronousChannel< T >.IsDone, System.Linq.Parallel.QueryTaskGroupState.QueryEnd(), System.Threading.ManualResetEventSlim.Reset(), System.Linq.Parallel.AsynchronousChannel< T >.TryDequeue(), System.Linq.Parallel.IntValueEvent.Value, and System.Threading.ManualResetEventSlim.Wait().

Referenced by System.Linq.Parallel.AsynchronousChannelMergeEnumerator< T >.MoveNext().