Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CommittableTransaction.cs
Go to the documentation of this file.
3
4namespace System.Transactions;
5
6[UnsupportedOSPlatform("browser")]
8{
9 object? IAsyncResult.AsyncState => _internalTransaction._asyncState;
10
11 bool IAsyncResult.CompletedSynchronously => false;
12
13 WaitHandle IAsyncResult.AsyncWaitHandle
14 {
15 get
16 {
18 {
20 {
22 {
24 _internalTransaction._asyncResultEvent = asyncResultEvent;
25 }
26 }
27 }
29 }
30 }
31
32 bool IAsyncResult.IsCompleted
33 {
34 get
35 {
37 {
39 }
40 }
41 }
42
44 : this(TransactionManager.DefaultIsolationLevel, TransactionManager.DefaultTimeout)
45 {
46 }
47
49 : this(TransactionManager.DefaultIsolationLevel, timeout)
50 {
51 }
52
57
59 : base(isoLevel, (InternalTransaction)null)
60 {
62 _internalTransaction._cloneCount = 1;
63 _cloneId = 1;
65 if (log.IsEnabled())
66 {
67 log.TransactionCreated(this, "CommittableTransaction");
68 }
69 }
70
71 public IAsyncResult BeginCommit(AsyncCallback? asyncCallback, object? asyncState)
72 {
74 if (log.IsEnabled())
75 {
76 log.MethodEnter(TraceSourceType.TraceSourceLtm, this, "BeginCommit");
77 log.TransactionCommit(this, "CommittableTransaction");
78 }
79 if (base.Disposed)
80 {
81 throw new ObjectDisposedException("CommittableTransaction");
82 }
84 {
85 if (_complete)
86 {
88 }
89 _internalTransaction.State.BeginCommit(_internalTransaction, asyncCommit: true, asyncCallback, asyncState);
90 }
91 if (log.IsEnabled())
92 {
93 log.MethodExit(TraceSourceType.TraceSourceLtm, this, "BeginCommit");
94 }
95 return this;
96 }
97
98 public void Commit()
99 {
101 if (log.IsEnabled())
102 {
103 log.MethodEnter(TraceSourceType.TraceSourceLtm, this, "Commit");
104 log.TransactionCommit(this, "CommittableTransaction");
105 }
106 if (base.Disposed)
107 {
108 throw new ObjectDisposedException("CommittableTransaction");
109 }
111 {
112 if (_complete)
113 {
115 }
116 _internalTransaction.State.BeginCommit(_internalTransaction, asyncCommit: false, null, null);
118 {
119 }
121 }
122 if (log.IsEnabled())
123 {
124 log.MethodExit(TraceSourceType.TraceSourceLtm, this, "Commit");
125 }
126 }
127
128 internal override void InternalDispose()
129 {
131 if (log.IsEnabled())
132 {
133 log.MethodEnter(TraceSourceType.TraceSourceLtm, this, "InternalDispose");
134 }
135 if (Interlocked.Exchange(ref _disposed, 1) == 1)
136 {
137 return;
138 }
140 {
142 {
144 }
145 }
147 if (num == 0L)
148 {
150 }
151 if (log.IsEnabled())
152 {
153 log.MethodExit(TraceSourceType.TraceSourceLtm, this, "InternalDispose");
154 }
155 }
156
158 {
160 if (log.IsEnabled())
161 {
162 log.MethodEnter(TraceSourceType.TraceSourceLtm, this, "EndCommit");
163 }
164 if (asyncResult != this)
165 {
166 throw new ArgumentException(System.SR.BadAsyncResult, "asyncResult");
167 }
169 {
171 {
172 }
174 }
175 if (log.IsEnabled())
176 {
177 log.MethodExit(TraceSourceType.TraceSourceLtm, this, "EndCommit");
178 }
179 }
180}
static string BadAsyncResult
Definition SR.cs:16
Definition SR.cs:7
static int Exchange(ref int location1, int value)
static int Decrement(ref int location)
static bool Wait(object obj, int millisecondsTimeout)
Definition Monitor.cs:87
IAsyncResult BeginCommit(AsyncCallback? asyncCallback, object? asyncState)
CommittableTransaction(IsolationLevel isoLevel, TimeSpan timeout)
static Exception CreateTransactionCompletedException(Guid distributedTxId)
virtual void EndCommit(InternalTransaction tx)
TransactionStatus get_Status(InternalTransaction tx)
virtual void BeginCommit(InternalTransaction tx, bool asyncCommit, AsyncCallback asyncCallback, object asyncState)
virtual void DisposeRoot(InternalTransaction tx)
virtual bool IsCompleted(InternalTransaction tx)
InternalTransaction _internalTransaction
void MethodExit(TraceSourceType traceSource, object thisOrContextObject, [CallerMemberName] string methodname=null)
static readonly TransactionsEtwProvider Log
void MethodEnter(TraceSourceType traceSource, object thisOrContextObject, [CallerMemberName] string methodname=null)
void TransactionCommit(Transaction transaction, string type)
void TransactionCreated(Transaction transaction, string type)