Mercurial > pub > ImplabNet
comparison Implab/Parallels/ArrayTraits.cs @ 145:706fccb85524 v2
RC: cancellation support for promises + tests
| author | cin |
|---|---|
| date | Sun, 08 Mar 2015 02:52:27 +0300 |
| parents | a336cb13c6a9 |
| children | cbe10ac0731e |
comparison
equal
deleted
inserted
replaced
| 144:8c0b95069066 | 145:706fccb85524 |
|---|---|
| 150 throw new ArgumentNullException("transform"); | 150 throw new ArgumentNullException("transform"); |
| 151 if (threads <= 0) | 151 if (threads <= 0) |
| 152 throw new ArgumentOutOfRangeException("threads","Threads number must be greater then zero"); | 152 throw new ArgumentOutOfRangeException("threads","Threads number must be greater then zero"); |
| 153 | 153 |
| 154 if (source.Length == 0) | 154 if (source.Length == 0) |
| 155 return Promise<TDst[]>.ResultToPromise(new TDst[0]); | 155 return Promise<TDst[]>.FromResult(new TDst[0]); |
| 156 | 156 |
| 157 var promise = new Promise<TDst[]>(); | 157 var promise = new Promise<TDst[]>(); |
| 158 var res = new TDst[source.Length]; | 158 var res = new TDst[source.Length]; |
| 159 var pending = source.Length; | 159 var pending = source.Length; |
| 160 | 160 |
