-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLongParallelQuerySettings.cs
More file actions
50 lines (44 loc) · 901 Bytes
/
LongParallelQuerySettings.cs
File metadata and controls
50 lines (44 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Grammophone.Parallel
{
/// <summary>
/// The settings for executing a <see cref="LongParallelQuery{S, T}"/>.
/// </summary>
internal class LongParallelQuerySettings
{
private int degreeOfParallelism;
private CancellationToken cancellationToken;
public LongParallelQuerySettings()
{
degreeOfParallelism = Environment.ProcessorCount;
cancellationToken = new CancellationToken();
}
public int DegreeOfParallelism
{
get
{
return degreeOfParallelism;
}
set
{
if (value < 0) throw new ArgumentException("Value must be positive.");
degreeOfParallelism = value;
}
}
public CancellationToken CancellationToken
{
get
{
return cancellationToken;
}
set
{
cancellationToken = value;
}
}
}
}