[PLinq] Sanitize QueryOptions to use property everywhere and add ShouldBeSequential...
authorJérémie Laval <jeremie.laval@gmail.com>
Thu, 2 Sep 2010 09:20:08 +0000 (10:20 +0100)
committerJérémie Laval <jeremie.laval@gmail.com>
Thu, 2 Sep 2010 09:35:45 +0000 (10:35 +0100)
mcs/class/System.Core/System.Linq.Parallel/QueryCheckerVisitor.cs
mcs/class/System.Core/System.Linq.Parallel/QueryOptions.cs

index b346ae2351597b8882006a2a5650802e1ac186e8..546228e8d9d1ac2bde9289fec53c29c176fa4a99 100644 (file)
@@ -117,7 +117,7 @@ namespace System.Linq.Parallel
                internal QueryOptions Options {
                        get {
                                return new QueryOptions (options, mode, token == null ? CancellationToken.None : token.Value,
-                                                        UseStrip, behindOrderGuard, partitionCount, implementerToken);
+                                                        UseStrip, behindOrderGuard, partitionCount, implementerToken, ShouldBeSequential);
                        }
                }
 
index 44c354d40f7559ce4538722fd6bfcbb604506bde..7ca9a8586d3edca94fcf833e8ff9e133ef6f2c60 100644 (file)
@@ -32,9 +32,20 @@ namespace System.Linq.Parallel
 {
        internal class QueryOptions
        {
-               public ParallelMergeOptions? Options;
-               public ParallelExecutionMode? Mode;
-               public CancellationToken Token;
+               public ParallelMergeOptions? Options {
+                       get;
+                       private set;
+               }
+
+               public ParallelExecutionMode? Mode {
+                       get;
+                       private set;
+               }
+
+               public CancellationToken Token {
+                       get;
+                       private set;
+               }
                /* This token is to be used by some operator (like Take) to tell that
                 * the execution of the query can be prematurly stopped
                 *
@@ -43,11 +54,40 @@ namespace System.Linq.Parallel
                 * set. Operator may chain up multiple cancellation token that way.
                 * When checking for this token, the task body should simply return.
                 */
-               public CancellationToken ImplementerToken;
-               public bool UseStrip;
-               public bool? BehindOrderGuard;
-               public int PartitionCount;
-               public Tuple<bool, bool, bool> PartitionerSettings;
+               public CancellationToken ImplementerToken {
+                       get;
+                       private set;
+               }
+
+               public bool UseStrip {
+                       get;
+                       private set;
+               }
+
+               public bool? BehindOrderGuard {
+                       get;
+                       private set;
+               }
+
+               public int PartitionCount {
+                       get;
+                       private set;
+               }
+
+               public Tuple<bool, bool, bool> PartitionerSettings {
+                       get;
+                       internal set;
+               }
+
+               public CancellationToken MergedToken {
+                       get;
+                       private set;
+               }
+
+               public bool ShouldBeSequential {
+                       get;
+                       private set;
+               }
 
                public QueryOptions (ParallelMergeOptions? options,
                                     ParallelExecutionMode? mode,
@@ -55,7 +95,8 @@ namespace System.Linq.Parallel
                                     bool useStrip,
                                     bool? behindOrderGuard,
                                     int partitionCount,
-                                    CancellationToken implementerToken)
+                                    CancellationToken implementerToken,
+                                    bool shouldBeSequential)
                {
                        Options = options;
                        Mode = mode;
@@ -65,6 +106,7 @@ namespace System.Linq.Parallel
                        PartitionCount = partitionCount;
                        PartitionerSettings = null;
                        ImplementerToken = implementerToken;
+                       ShouldBeSequential = shouldBeSequential;
 
                        MergeTokens (token, implementerToken);
                }
@@ -82,11 +124,6 @@ namespace System.Linq.Parallel
                        else
                                MergedToken = CancellationToken.None;
                }
-
-               public CancellationToken MergedToken {
-                       get;
-                       private set;
-               }
        }
 }
 #endif