[System.Core] Remove generic indirection in ParallelExecuter.Process
authorJérémie Laval <jeremie.laval@gmail.com>
Tue, 4 Sep 2012 12:53:54 +0000 (13:53 +0100)
committerJérémie Laval <jeremie.laval@gmail.com>
Tue, 4 Sep 2012 12:57:33 +0000 (13:57 +0100)
mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs

index a8c19d68b15b216db946af22625429c0db3ab5a2..262e8d112ea0aba9bdafd2616b5794dd1388f1fb 100644 (file)
@@ -127,14 +127,14 @@ namespace System.Linq.Parallel
                {
                        QueryOptions options = CheckQuery (node, true);
 
-                       Task[] tasks = Process (node, call, (n, o) => n.GetEnumerables (o), options);
+                       Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetEnumerables, options);
                        Task.WaitAll (tasks, options.Token);
                }
 
                internal static Action ProcessAndCallback<T> (QueryBaseNode<T> node, Action<T, CancellationToken> call,
                                                              Action callback, QueryOptions options)
                {
-                       Task[] tasks = Process (node, call, (n, o) => n.GetEnumerables (o), options);
+                       Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetEnumerables, options);
                        if (callback != null)
                                Task.Factory.ContinueWhenAll (tasks,  (_) => callback ());
 
@@ -145,7 +145,7 @@ namespace System.Linq.Parallel
                                                              Action endAction,
                                                              Action callback, QueryOptions options)
                {
-                       Task[] tasks = Process (node, call, (n, o) => n.GetOrderedEnumerables (o), endAction, options);
+                       Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetOrderedEnumerables, endAction, options);
                        if (callback != null)
                                Task.Factory.ContinueWhenAll (tasks,  (_) => callback ());
 
@@ -232,6 +232,19 @@ namespace System.Linq.Parallel
                                }
                        }
                }
+
+               class QueryBaseNodeHelper<T>
+               {
+                       internal IList<IEnumerable<T>> GetEnumerables (QueryBaseNode<T> source, QueryOptions options)
+                       {
+                               return source.GetEnumerables (options);
+                       }
+
+                       internal IList<IEnumerable<KeyValuePair<long,T>>> GetOrderedEnumerables (QueryBaseNode<T> source, QueryOptions options)
+                       {
+                               return source.GetOrderedEnumerables (options);
+                       }
+               }
        }
 }
 #endif
\ No newline at end of file