Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MultiAsyncResult.cs
Go to the documentation of this file.
2
3namespace System.Net.Mime;
4
5internal sealed class MultiAsyncResult : System.Net.LazyAsyncResult
6{
7 private readonly object _context;
8
9 private int _outstanding;
10
11 internal object Context => _context;
12
13 internal MultiAsyncResult(object context, AsyncCallback callback, object state)
14 : base(context, state, callback)
15 {
16 _context = context;
17 }
18
19 internal void Enter()
20 {
21 Increment();
22 }
23
24 internal void Leave()
25 {
26 Decrement();
27 }
28
29 internal void Leave(object result)
30 {
31 base.Result = result;
32 Decrement();
33 }
34
35 private void Decrement()
36 {
37 if (Interlocked.Decrement(ref _outstanding) == -1)
38 {
39 InvokeCallback(base.Result);
40 }
41 }
42
43 private void Increment()
44 {
46 }
47
48 internal void CompleteSequence()
49 {
50 Decrement();
51 }
52
53 internal static object End(IAsyncResult result)
54 {
55 MultiAsyncResult multiAsyncResult = (MultiAsyncResult)result;
56 multiAsyncResult.InternalWaitForCompletion();
57 return multiAsyncResult.Result;
58 }
59}
MultiAsyncResult(object context, AsyncCallback callback, object state)
static object End(IAsyncResult result)
static int Decrement(ref int location)
static int Increment(ref int location)