diff Implab/Parallels/ArrayTraits.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 2fad2d1f4b03
children 2fc0fbe7d58b
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;