view Implab/IPromise.cs @ 32:8eca2652d2ff

fixed: StackOverflow in IPromiseBase.Then(handler) fixed: hang in ChainMap method on empty arrays
author cin
date Tue, 08 Apr 2014 23:25:01 +0400
parents f0bf98e4d22c
children b255e4aeef17
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Implab
{
    public interface IPromise<T>: IPromiseBase
    {

        T Join();

        T Join(int timeout);

        IPromise<T> Then(ResultHandler<T> success, ErrorHandler error);
        IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error);
        IPromise<T> Then(ResultHandler<T> success);
        IPromise<T> Error(ErrorHandler error);
        IPromise<T> Error(ErrorHandler<T> error);

        IPromise<T2> Map<T2>(ResultMapper<T,T2> mapper, ErrorHandler error);
        IPromise<T2> Map<T2>(ResultMapper<T, T2> mapper);

        IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained, ErrorHandler error);
        IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained);

        IPromise<T> Cancelled(Action handler);
        IPromise<T> Finally(Action handler);
        IPromise<T> Anyway(Action handler);

    }
}