Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
OrderPreservingPipeliningSpoolingTask.cs
Go to the documentation of this file.
4
6
7internal sealed class OrderPreservingPipeliningSpoolingTask<TOutput, TKey> : SpoolingTaskBase
8{
10
12
13 private readonly bool[] _consumerWaiting;
14
15 private readonly bool[] _producerWaiting;
16
17 private readonly bool[] _producerDone;
18
19 private readonly int _partitionIndex;
20
22
23 private readonly object _bufferLock;
24
25 private readonly bool _autoBuffered;
26
40
41 protected override void SpoolingWork()
42 {
43 TOutput currentElement = default(TOutput);
44 TKey currentKey = default(TKey);
45 int num = ((!_autoBuffered) ? 1 : 16);
49 int i;
50 do
51 {
52 for (i = 0; i < num; i++)
53 {
54 if (!partition.MoveNext(ref currentElement, ref currentKey))
55 {
56 break;
57 }
58 array[i] = new Pair<TKey, TOutput>(currentKey, currentElement);
59 }
60 if (i == 0)
61 {
62 break;
63 }
65 {
66 if (mergedCancellationToken.IsCancellationRequested)
67 {
68 break;
69 }
70 for (int j = 0; j < i; j++)
71 {
73 }
75 {
78 }
79 if (_buffers[_partitionIndex].Count >= 8192)
80 {
83 }
84 }
85 }
86 while (i == num);
87 }
88
108
109 protected override void SpoolingFinally()
110 {
112 {
115 {
118 }
119 }
120 base.SpoolingFinally();
122 }
123}
OrderPreservingPipeliningSpoolingTask(QueryOperatorEnumerator< TOutput, TKey > partition, QueryTaskGroupState taskGroupState, bool[] consumerWaiting, bool[] producerWaiting, bool[] producerDone, int partitionIndex, Queue< Pair< TKey, TOutput > >[] buffers, object bufferLock, bool autoBuffered)
static void Spool(QueryTaskGroupState groupState, PartitionedStream< TOutput, TKey > partitions, bool[] consumerWaiting, bool[] producerWaiting, bool[] producerDone, Queue< Pair< TKey, TOutput > >[] buffers, object[] bufferLocks, TaskScheduler taskScheduler, bool autoBuffered)
static bool Wait(object obj, int millisecondsTimeout)
Definition Monitor.cs:87
static void Pulse(object obj)
Definition Monitor.cs:103