changeset 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 dafaadca5b9f
children b255e4aeef17
files Implab/Parallels/ArrayTraits.cs Implab/Promise.cs
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Implab/Parallels/ArrayTraits.cs	Mon Apr 07 18:17:00 2014 +0400
+++ b/Implab/Parallels/ArrayTraits.cs	Tue Apr 08 23:25:01 2014 +0400
@@ -133,6 +133,9 @@
             if (threads <= 0)
                 throw new ArgumentOutOfRangeException("Threads number must be greater then zero");
 
+            if (source.Length == 0)
+                return Promise<TDst[]>.ResultToPromise(new TDst[0]);
+
             var promise = new Promise<TDst[]>();
             var res = new TDst[source.Length];
             var pending = source.Length;
--- a/Implab/Promise.cs	Mon Apr 07 18:17:00 2014 +0400
+++ b/Implab/Promise.cs	Tue Apr 08 23:25:01 2014 +0400
@@ -236,7 +236,7 @@
 
         public IPromiseBase Then(Action success)
         {
-            return Then(success);
+            return Then(x => success());
         }
 
         /// <summary>