Mercurial > pub > ImplabNet
comparison Implab/Parallels/ArrayTraits.cs @ 242:cbe10ac0731e v3
Working on promises
| author | cin |
|---|---|
| date | Wed, 24 Jan 2018 03:03:21 +0300 |
| parents | 706fccb85524 |
| children |
comparison
equal
deleted
inserted
replaced
| 240:fa6cbf4d8841 | 242:cbe10ac0731e |
|---|---|
| 162 int slots = threads; | 162 int slots = threads; |
| 163 | 163 |
| 164 // Analysis disable AccessToDisposedClosure | 164 // Analysis disable AccessToDisposedClosure |
| 165 AsyncPool.RunThread<int>(() => { | 165 AsyncPool.RunThread<int>(() => { |
| 166 for (int i = 0; i < source.Length; i++) { | 166 for (int i = 0; i < source.Length; i++) { |
| 167 if(promise.IsResolved) | 167 if(promise.IsFulfilled) |
| 168 break; // stop processing in case of error or cancellation | 168 break; // stop processing in case of error or cancellation |
| 169 var idx = i; | 169 var idx = i; |
| 170 | 170 |
| 171 if (Interlocked.Decrement(ref slots) < 0) { | 171 if (Interlocked.Decrement(ref slots) < 0) { |
| 172 lock(locker) { | 172 lock(locker) { |
