diff Implab/Parallels/AsyncPool.cs @ 120:f1b897999260 v2

improved asyncpool usability working on batch operations on asyncqueue
author cin
date Mon, 12 Jan 2015 05:19:52 +0300
parents 2573b562e328
children 62d2f1e98c4e
line wrap: on
line diff
--- a/Implab/Parallels/AsyncPool.cs	Sun Jan 11 19:13:02 2015 +0300
+++ b/Implab/Parallels/AsyncPool.cs	Mon Jan 12 05:19:52 2015 +0300
@@ -1,6 +1,7 @@
 using Implab.Diagnostics;
 using System;
 using System.Threading;
+using System.Linq;
 
 namespace Implab.Parallels {
 	/// <summary>
@@ -73,5 +74,13 @@
 
             return p;
         }
+
+        public static IPromise[] ThreadRun(params Action[] func) {
+            return func.Select(f => InvokeNewThread(f)).ToArray();
+        }
+
+        public static IPromise<T>[] ThreadRun<T>(params Func<T>[] func) {
+            return func.Select(f => InvokeNewThread(f)).ToArray();
+        }
 	}
 }