Exemple #1
0
        public async Task RunTask(Func <Task> func)
        {
            DispatcherHandle handle = new DispatcherHandle(func);

            await Run(handle);

            await(Task) handle.Result;
        }
Exemple #2
0
        public async Task <TResult> RunTask <TResult>(Func <Task <TResult> > func)
        {
            DispatcherHandle handle = new DispatcherHandle(() => func());

            await Run(handle);

            return(await(Task <TResult>) handle.Result);
        }
Exemple #3
0
        private async Task Run(DispatcherHandle handle)
        {
            await runQueueSem.WaitAsync().ConfigureAwait(false);

            try
            {
                await handler.Run(handle);
            }
            finally
            {
                runQueueSem.Release();
            }
        }
Exemple #4
0
        public async Task Run(DispatcherHandle handle)
        {
            try
            {
                currentHandle = handle;
                runTriggerSem.Release();
                await resultTriggerSem.WaitAsync().ConfigureAwait(false);

                if (currentHandle.Exception != null)
                {
                    throw currentHandle.Exception;
                }
            }
            finally
            {
                currentHandle = null;
            }
        }
Exemple #5
0
        public async Task Run(Action action)
        {
            DispatcherHandle handle = new DispatcherHandle(action);

            await Run(handle);
        }