Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BatchedJoinBlockTargetSharedResources.cs
Go to the documentation of this file.
2
4{
5 internal readonly object _incomingLock;
6
7 internal readonly int _batchSize;
8
9 internal readonly Action _batchSizeReachedAction;
10
11 internal readonly Action _allTargetsDecliningPermanentlyAction;
12
13 internal readonly Action<Exception> _exceptionAction;
14
15 internal readonly Action _completionAction;
16
18
20
21 internal bool _decliningPermanently;
22
23 internal long _batchesCreated;
24
25 internal BatchedJoinBlockTargetSharedResources(int batchSize, GroupingDataflowBlockOptions dataflowBlockOptions, Action batchSizeReachedAction, Action allTargetsDecliningAction, Action<Exception> exceptionAction, Action completionAction)
26 {
27 BatchedJoinBlockTargetSharedResources batchedJoinBlockTargetSharedResources = this;
28 _incomingLock = new object();
29 _batchSize = batchSize;
31 _remainingItemsInBatch = batchSize;
33 {
34 allTargetsDecliningAction();
35 batchedJoinBlockTargetSharedResources._decliningPermanently = true;
36 };
38 {
39 batchSizeReachedAction();
40 batchedJoinBlockTargetSharedResources._batchesCreated++;
41 if (batchedJoinBlockTargetSharedResources._batchesCreated >= dataflowBlockOptions.ActualMaxNumberOfGroups)
42 {
43 batchedJoinBlockTargetSharedResources._allTargetsDecliningPermanentlyAction();
44 }
45 else
46 {
47 batchedJoinBlockTargetSharedResources._remainingItemsInBatch = batchedJoinBlockTargetSharedResources._batchSize;
48 }
49 };
50 _exceptionAction = exceptionAction;
51 _completionAction = completionAction;
52 }
53}
BatchedJoinBlockTargetSharedResources(int batchSize, GroupingDataflowBlockOptions dataflowBlockOptions, Action batchSizeReachedAction, Action allTargetsDecliningAction, Action< Exception > exceptionAction, Action completionAction)