コード例 #1
0
 public Task Enqueue(Func <Task> taskGenerator)
 {
     return((Task)this.Enqueue <bool>((Func <Task <bool> >)(() => TaskUtilities.WithResult <bool>(taskGenerator(), true))));
 }
コード例 #2
0
        public async Task <T> Enqueue <T>(Func <Task <T> > taskGenerator)
        {
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            int num1 = (^ this).\u003C\u003E1__state;
            T   result;

            try
            {
                TaskAwaiter awaiter1 = this.semaphore.WaitAsync().GetAwaiter();
                if (!awaiter1.IsCompleted)
                {
                    int num2;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003E1__state = num2 = 0;
                    TaskAwaiter taskAwaiter = awaiter1;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, Ekreta.Mobile.Core.Helpers.TaskQueue.TaskQueue.\u003CEnqueue\u003Ed__9 <T> >(ref awaiter1, this);
                    return;
                }
                awaiter1.GetResult();
                int  numberOfRetries = this.NumberOfRetries;
                Task delay           = (Task)null;
                try
                {
                    ConfiguredTaskAwaitable <T> .ConfiguredTaskAwaiter awaiter2 = TaskUtilities.RetryOnFailure <T>((Func <Task <T> >)(() =>
                    {
                        delay = Task.Delay(this.TimeBetweenTaskExecutions);
                        return(taskGenerator());
                    }), this.NumberOfRetries, new TimeSpan?(this.TimeBetweenTaskExecutions)).ConfigureAwait(false).GetAwaiter();
                    if (!awaiter2.IsCompleted)
                    {
                        // ISSUE: explicit reference operation
                        // ISSUE: reference to a compiler-generated field
                        (^ this).\u003C\u003E1__state = num1 = 1;
                        ConfiguredTaskAwaitable <T> .ConfiguredTaskAwaiter configuredTaskAwaiter = awaiter2;
                        // ISSUE: explicit reference operation
                        // ISSUE: reference to a compiler-generated field
                        (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <ConfiguredTaskAwaitable <T> .ConfiguredTaskAwaiter, Ekreta.Mobile.Core.Helpers.TaskQueue.TaskQueue.\u003CEnqueue\u003Ed__9 <T> >(ref awaiter2, this);
                        return;
                    }
                    result = awaiter2.GetResult();
                }
                finally
                {
                    if (num1 < 0)
                    {
                        this.ReleaseAfterDelay(delay);
                    }
                }
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(result);
        }