comparison 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
comparison
equal deleted inserted replaced
31:dafaadca5b9f 32:8eca2652d2ff
131 if (transform == null) 131 if (transform == null)
132 throw new ArgumentNullException("transform"); 132 throw new ArgumentNullException("transform");
133 if (threads <= 0) 133 if (threads <= 0)
134 throw new ArgumentOutOfRangeException("Threads number must be greater then zero"); 134 throw new ArgumentOutOfRangeException("Threads number must be greater then zero");
135 135
136 if (source.Length == 0)
137 return Promise<TDst[]>.ResultToPromise(new TDst[0]);
138
136 var promise = new Promise<TDst[]>(); 139 var promise = new Promise<TDst[]>();
137 var res = new TDst[source.Length]; 140 var res = new TDst[source.Length];
138 var pending = source.Length; 141 var pending = source.Length;
139 142
140 var semaphore = new Semaphore(threads, threads); 143 var semaphore = new Semaphore(threads, threads);