Esempio n. 1
0
            static CanceledETTaskCache()
            {
                var promise = new ETTaskCompletionSource <T>();

                promise.TrySetCanceled();
                Task = new ETTask <T>(promise);
            }
Esempio n. 2
0
            static CanceledETTaskCache()
            {
                ETTaskCompletionSource tcs = new ETTaskCompletionSource();

                tcs.TrySetCanceled();
                Task = tcs.Task;
            }
Esempio n. 3
0
        // 3. SetException
        //[DebuggerHidden]
        public void SetException(Exception exception)
        {
            if (promise == null)
            {
                promise = new ETTaskCompletionSource();
            }

            if (exception is OperationCanceledException ex)
            {
                promise.TrySetCanceled(ex);
            }
            else
            {
                promise.TrySetException(exception);
            }
        }