summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKoundinya Veluri <kouvel@users.noreply.github.com>2016-10-14 11:55:02 -0700
committerGitHub <noreply@github.com>2016-10-14 11:55:02 -0700
commitc944e13d66ddc09bc1f7f35e252a9f0837601348 (patch)
treeeae0968bb25845a8713d286e18573504c9f44535 /src
parentc449879e7a1ec2556bcb157e86e25a8517e9bacb (diff)
parente1ef4b892f95141e9d27716f46eeb494c1a078f8 (diff)
downloadcoreclr-c944e13d66ddc09bc1f7f35e252a9f0837601348.tar.gz
coreclr-c944e13d66ddc09bc1f7f35e252a9f0837601348.tar.bz2
coreclr-c944e13d66ddc09bc1f7f35e252a9f0837601348.zip
Merge pull request #4056 from svick/threadpoolglobals-readonly
Make fields in ThreadPool readonly/const where possible
Diffstat (limited to 'src')
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPool.cs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mscorlib/src/System/Threading/ThreadPool.cs b/src/mscorlib/src/System/Threading/ThreadPool.cs
index 046dabe72d..6340ecbba4 100644
--- a/src/mscorlib/src/System/Threading/ThreadPool.cs
+++ b/src/mscorlib/src/System/Threading/ThreadPool.cs
@@ -29,14 +29,12 @@
namespace System.Threading
{
using System.Security;
- using System.Runtime.Remoting;
using System.Security.Permissions;
using System;
using Microsoft.Win32;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
- using System.Runtime.Versioning;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Diagnostics.CodeAnalysis;
@@ -46,17 +44,17 @@ namespace System.Threading
{
//Per-appDomain quantum (in ms) for which the thread keeps processing
//requests in the current domain.
- public static uint tpQuantum = 30U;
+ public const uint TP_QUANTUM = 30U;
- public static int processorCount = Environment.ProcessorCount;
+ public static readonly int processorCount = Environment.ProcessorCount;
- public static bool tpHosted = ThreadPool.IsThreadPoolHosted();
+ public static readonly bool tpHosted = ThreadPool.IsThreadPoolHosted();
public static volatile bool vmTpInitialized;
public static bool enableWorkerTracking;
[SecurityCritical]
- public static ThreadPoolWorkQueue workQueue = new ThreadPoolWorkQueue();
+ public static readonly ThreadPoolWorkQueue workQueue = new ThreadPoolWorkQueue();
[System.Security.SecuritySafeCritical] // static constructors should be safe to call
static ThreadPoolGlobals()
@@ -546,7 +544,7 @@ namespace System.Threading
internal volatile QueueSegment queueTail;
internal bool loggingEnabled;
- internal static SparseArray<WorkStealingQueue> allThreadQueues = new SparseArray<WorkStealingQueue>(16);
+ internal static readonly SparseArray<WorkStealingQueue> allThreadQueues = new SparseArray<WorkStealingQueue>(16);
private volatile int numOutstandingThreadRequests = 0;
@@ -709,7 +707,7 @@ namespace System.Threading
{
var workQueue = ThreadPoolGlobals.workQueue;
//
- // The clock is ticking! We have ThreadPoolGlobals.tpQuantum milliseconds to get some work done, and then
+ // The clock is ticking! We have ThreadPoolGlobals.TP_QUANTUM milliseconds to get some work done, and then
// we need to return to the VM.
//
int quantumStartTime = Environment.TickCount;
@@ -743,7 +741,7 @@ namespace System.Threading
//
// Loop until our quantum expires.
//
- while ((Environment.TickCount - quantumStartTime) < ThreadPoolGlobals.tpQuantum)
+ while ((Environment.TickCount - quantumStartTime) < ThreadPoolGlobals.TP_QUANTUM)
{
//
// Dequeue and EnsureThreadRequested must be protected from ThreadAbortException.