diff Implab/Parallels/ArrayTraits.cs @ 119:2573b562e328 v2

Promises rewritten, added improved version of AsyncQueue
author cin
date Sun, 11 Jan 2015 19:13:02 +0300
parents 5f10d54b45df
children a336cb13c6a9
line wrap: on
line diff
--- a/Implab/Parallels/ArrayTraits.cs	Sun Dec 28 16:09:03 2014 +0300
+++ b/Implab/Parallels/ArrayTraits.cs	Sun Jan 11 19:13:02 2015 +0300
@@ -26,7 +26,7 @@
                 m_pending = source.Length;
                 m_action = action;
 
-                m_promise.Anyway(Dispose);
+                m_promise.On(Dispose, PromiseEventType.All);
 
                 InitPool();
             }
@@ -86,7 +86,7 @@
                 m_transform = transform;
                 m_logicalOperation = TraceContext.Instance.CurrentOperation;
 
-                m_promise.Anyway(Dispose);
+                m_promise.On(Dispose, PromiseEventType.All);
 
                 InitPool();
             }
@@ -162,7 +162,7 @@
             int slots = threads;
 
             // Analysis disable AccessToDisposedClosure
-            AsyncPool.InvokeNewThread(() => {
+            AsyncPool.InvokeNewThread<int>(() => {
                 for (int i = 0; i < source.Length; i++) {
                     if(promise.IsResolved)
                         break; // stop processing in case of error or cancellation
@@ -177,7 +177,7 @@
 
                     try {
                         transform(source[i])
-                            .Anyway(() => {
+                            .On( x => {
                                 Interlocked.Increment(ref slots);
                                 lock (locker) {
                                     Monitor.Pulse(locker);