Mercurial > pub > ImplabNet
diff Implab/Parallels/ArrayTraits.cs @ 76:c761fc982e1d v2
Refactoring of the IPromise<T> interface
Added tests
author | cin |
---|---|
date | Wed, 10 Sep 2014 17:53:05 +0400 |
parents | 4439140706d0 |
children | 4f20870d0816 |
line wrap: on
line diff
--- a/Implab/Parallels/ArrayTraits.cs Wed Sep 10 11:17:37 2014 +0400 +++ b/Implab/Parallels/ArrayTraits.cs Wed Sep 10 17:53:05 2014 +0400 @@ -29,7 +29,7 @@ m_pending = source.Length; m_action = action; - m_promise.Finally(Dispose); + m_promise.Anyway(Dispose); InitPool(); } @@ -85,7 +85,7 @@ m_transform = transform; m_traceContext = TraceContext.Snapshot(); - m_promise.Finally(Dispose); + m_promise.Anyway(Dispose); InitPool(); } @@ -138,7 +138,7 @@ return iter.Promise; } - public static IPromise<TDst[]> ChainedMap<TSrc, TDst>(this TSrc[] source, ChainedOperation<TSrc, TDst> transform, int threads) { + public static IPromise<TDst[]> ChainedMap<TSrc, TDst>(this TSrc[] source, ResultMapper<TSrc, IPromise<TDst>> transform, int threads) { if (source == null) throw new ArgumentNullException("source"); if (transform == null) @@ -165,7 +165,7 @@ semaphore.WaitOne(); try { var p1 = transform(source[i]); - p1.Finally(() => semaphore.Release()); + p1.Anyway(() => semaphore.Release()); p1.Then( x => { res[idx] = x; @@ -186,7 +186,7 @@ return 0; }); - return promise.Finally(semaphore.Dispose); + return promise.Anyway(semaphore.Dispose); } }