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

◆ FromAsyncCoreLogic()

static void System.Threading.Tasks.TaskFactory< TResult >.FromAsyncCoreLogic ( IAsyncResult iar,
Func< IAsyncResult, TResult > endFunction,
Action< IAsyncResult > endAction,
Task< TResult > promise,
bool requiresSynchronization )
inlinestaticprivate

Definition at line 177 of file TaskFactory.cs.

178 {
179 Exception ex = null;
180 OperationCanceledException ex2 = null;
181 TResult result = default(TResult);
182 try
183 {
184 if (endFunction != null)
185 {
186 result = endFunction(iar);
187 }
188 else
189 {
190 endAction(iar);
191 }
192 }
193 catch (OperationCanceledException ex3)
194 {
195 ex2 = ex3;
196 }
197 catch (Exception ex4)
198 {
199 ex = ex4;
200 }
201 finally
202 {
203 if (ex2 != null)
204 {
205 promise.TrySetCanceled(ex2.CancellationToken, ex2);
206 }
207 else if (ex != null)
208 {
209 promise.TrySetException(ex);
210 }
211 else
212 {
213 if (TplEventSource.Log.IsEnabled())
214 {
215 TplEventSource.Log.TraceOperationEnd(promise.Id, AsyncCausalityStatus.Completed);
216 }
217 if (Task.s_asyncDebuggingEnabled)
218 {
219 Task.RemoveFromActiveTasks(promise);
220 }
222 {
223 promise.TrySetResult(result);
224 }
225 else
226 {
227 promise.DangerousSetResult(result);
228 }
229 }
230 }
231 }

References System.endFunction, System.Threading.Tasks.TplEventSource.Log, System.Threading.Tasks.Task< TResult >.RemoveFromActiveTasks(), and System.Threading.Tasks.Task< TResult >.s_asyncDebuggingEnabled.

Referenced by System.Threading.Tasks.TaskFactory< TResult >.FromAsyncImpl().