view Implab/Promise.cs @ 221:8808383fcb94 v2

fixed recursion in Safe.Dispose with IEnumerable
author cin
date Fri, 23 Jun 2017 01:03:42 +0300
parents 8200ab154c8a
children b1e0ffdf3451
line wrap: on
line source

using System;
using Implab.Parallels;

namespace Implab {
    public class Promise : AbstractPromise, IDeferred {
        public static readonly IPromise Success;

        static Promise() {
            Success = new SuccessPromise();
        }

        public void Resolve() {
            SetResult();
        }

        public void Reject(Exception error) {
            SetError(error);
        }

        public static IPromise FromException(Exception exception) {
            return new FailedPromise(exception);
        }
    }
}