diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs
index a23d8413b0..ea42fa2ad7 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs
@@ -57,7 +57,7 @@ private static TimeSpan Time
///
[Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Now marked as obsolete.")]
[EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULEREQUIRED)] // Preferring static method call over instance method call.
+ [Obsolete(Constants_Core.ObsoleteSchedulerequired)] // Preferring static method call over instance method call.
public bool ScheduleRequired => IsScheduleRequired;
///
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/DisableOptimizationsScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/DisableOptimizationsScheduler.cs
index 8cb99c7cfe..1980aed0bc 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/DisableOptimizationsScheduler.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/DisableOptimizationsScheduler.cs
@@ -14,7 +14,7 @@ internal sealed class DisableOptimizationsScheduler : SchedulerWrapper
public DisableOptimizationsScheduler(IScheduler scheduler)
: base(scheduler)
{
- _optimizationInterfaces = Scheduler.OPTIMIZATIONS;
+ _optimizationInterfaces = Scheduler.Optimizations;
}
public DisableOptimizationsScheduler(IScheduler scheduler, Type[] optimizationInterfaces)
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs
index e637405744..250a87747f 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs
@@ -61,7 +61,7 @@ public partial class LocalScheduler
/// Threshold where an item is considered to be short term work or gets moved from
/// long term to short term.
///
- private static readonly TimeSpan SHORTTERM = TimeSpan.FromSeconds(10);
+ private static readonly TimeSpan ShortTerm = TimeSpan.FromSeconds(10);
///
/// Maximum error ratio for timer drift. We've seen machines with 10s drift on a
@@ -79,14 +79,14 @@ public partial class LocalScheduler
/// enough time to transition work to short term and as a courtesy to the
/// destination scheduler to manage its queues etc.
///
- private const int MAXERRORRATIO = 1000;
+ private const int MaxErrorRatio = 1000;
///
/// Minimum threshold for the long term timer to fire before the queue is reevaluated
/// for short term work. This value is chosen to be less than SHORTTERM in order to
/// ensure the timer fires and has work to transition to the short term queue.
///
- private static readonly TimeSpan LONGTOSHORT = TimeSpan.FromSeconds(5);
+ private static readonly TimeSpan LongToShort = TimeSpan.FromSeconds(5);
///
/// Threshold used to determine when a short term timer has fired too early compared
@@ -94,12 +94,12 @@ public partial class LocalScheduler
/// completion of scheduled work, which can happen in case of time adjustment in the
/// operating system (cf. GetSystemTimeAdjustment).
///
- private static readonly TimeSpan RETRYSHORT = TimeSpan.FromMilliseconds(50);
+ private static readonly TimeSpan RetryShort = TimeSpan.FromMilliseconds(50);
///
/// Longest interval supported by timers in the BCL.
///
- private static readonly TimeSpan MAXSUPPORTEDTIMER = TimeSpan.FromMilliseconds((1L << 32) - 2);
+ private static readonly TimeSpan MaxSupportedTimer = TimeSpan.FromMilliseconds((1L << 32) - 2);
///
/// Creates a new local scheduler.
@@ -153,7 +153,7 @@ private IDisposable Enqueue(TState state, DateTimeOffset dueTime, Func(this, state, dueTime, action);
- if (due <= SHORTTERM)
+ if (due <= ShortTerm)
{
ScheduleShortTermWork(workItem);
}
@@ -242,7 +242,7 @@ private IDisposable ExecuteNextShortTermWorkItem(IScheduler scheduler, IDisposab
// have only "little" impact (range of 100s of ms). On an absolute time scale, we
// don't provide stronger guarantees.
//
- if (next.DueTime - next.Scheduler.Now >= RETRYSHORT)
+ if (next.DueTime - next.Scheduler.Now >= RetryShort)
{
ScheduleShortTermWork(next);
}
@@ -324,13 +324,13 @@ private static void UpdateLongTermProcessingTimer()
// error due to drift is negligible.
//
var due = Scheduler.Normalize(next.DueTime - next.Scheduler.Now);
- var remainder = TimeSpan.FromTicks(Math.Max(due.Ticks / MAXERRORRATIO, LONGTOSHORT.Ticks));
+ var remainder = TimeSpan.FromTicks(Math.Max(due.Ticks / MaxErrorRatio, LongToShort.Ticks));
var dueEarly = due - remainder;
//
// Limit the interval to maximum supported by underlying Timer.
//
- var dueCapped = TimeSpan.FromTicks(Math.Min(dueEarly.Ticks, MAXSUPPORTEDTIMER.Ticks));
+ var dueCapped = TimeSpan.FromTicks(Math.Min(dueEarly.Ticks, MaxSupportedTimer.Ticks));
_nextLongTermWorkItem = next;
_nextLongTermTimer.Disposable = ConcurrencyAbstractionLayer.Current.StartTimer(_ => EvaluateLongTermQueue(), null, dueCapped);
@@ -352,7 +352,7 @@ private static void EvaluateLongTermQueue()
next = _longTerm.Peek();
var due = Scheduler.Normalize(next.DueTime - next.Scheduler.Now);
- if (due >= SHORTTERM)
+ if (due >= ShortTerm)
{
break;
}
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs
index 403596edd7..a8ba479125 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs
@@ -330,7 +330,7 @@ public SchedulePeriodicStopwatch(IScheduler scheduler, TState state, TimeSpan pe
_stopwatchProvider = stopwatchProvider;
_state = state;
- _runState = STOPPED;
+ _runState = Stopped;
}
private TState _state;
@@ -362,10 +362,10 @@ public SchedulePeriodicStopwatch(IScheduler scheduler, TState state, TimeSpan pe
// (d) Dispose returned object from Start --> scheduled work is cancelled
// (e) Dispose returned object from Start --> unblocks _resumeEvent, Tick exits
//
- private const int STOPPED = 0;
- private const int RUNNING = 1;
- private const int SUSPENDED = 2;
- private const int DISPOSED = 3;
+ private const int Stopped = 0;
+ private const int Running = 1;
+ private const int Suspended = 2;
+ private const int Disposed = 3;
private IDisposable _task;
@@ -375,7 +375,7 @@ public IDisposable Start()
_stopwatch = _stopwatchProvider.StartStopwatch();
_nextDue = _period;
- _runState = RUNNING;
+ _runState = Running;
Disposable.TrySetSingle(ref _task, _scheduler.Schedule(this, _nextDue, (@this, a) => @this.Tick(a)));
return this;
@@ -398,7 +398,7 @@ private void Tick(Action, TimeSpan> recurse)
{
lock (_gate)
{
- if (_runState == RUNNING)
+ if (_runState == Running)
{
//
// This is the fast path. We just let the stopwatch continue to
@@ -410,7 +410,7 @@ private void Tick(Action, TimeSpan> recurse)
break;
}
- if (_runState == DISPOSED)
+ if (_runState == Disposed)
{
//
// In case the periodic job gets disposed but we are currently
@@ -427,7 +427,7 @@ private void Tick(Action, TimeSpan> recurse)
// to block such that future reevaluations of the next due time
// will pick up the cumulative inactive time delta.
//
- Debug.Assert(_runState == SUSPENDED);
+ Debug.Assert(_runState == Suspended);
}
//
@@ -449,7 +449,7 @@ private void Cancel()
lock (_gate)
{
- _runState = DISPOSED;
+ _runState = Disposed;
if (!Environment.HasShutdownStarted)
{
@@ -476,10 +476,10 @@ private void Suspending(object sender, HostSuspendingEventArgs args)
//
lock (_gate)
{
- if (_runState == RUNNING)
+ if (_runState == Running)
{
_suspendedAt = _stopwatch.Elapsed;
- _runState = SUSPENDED;
+ _runState = Suspended;
if (!Environment.HasShutdownStarted)
{
@@ -510,10 +510,10 @@ private void Resuming(object sender, HostResumingEventArgs args)
//
lock (_gate)
{
- if (_runState == SUSPENDED)
+ if (_runState == Suspended)
{
_inactiveTime += _stopwatch.Elapsed - _suspendedAt;
- _runState = RUNNING;
+ _runState = Running;
if (!Environment.HasShutdownStarted)
{
@@ -573,8 +573,8 @@ public IDisposable Start()
// The protocol using the three commands is explained in the Tick implementation below.
//
private const int TICK = 0;
- private const int DISPATCH_START = 1;
- private const int DISPATCH_END = 2;
+ private const int DispatchStart = 1;
+ private const int DispatchEnd = 2;
private void Tick(int command, Action recurse)
{
@@ -596,12 +596,12 @@ private void Tick(int command, Action recurse)
//
if (Interlocked.Increment(ref _pendingTickCount) == 1)
{
- goto case DISPATCH_START;
+ goto case DispatchStart;
}
break;
- case DISPATCH_START:
+ case DispatchStart:
try
{
_state = _action(_state);
@@ -625,11 +625,11 @@ private void Tick(int command, Action recurse)
// disabled using DisableOptimizations; legacy implementations of schedulers
// from the v1.x days will not have a stopwatch).
//
- recurse(DISPATCH_END, TimeSpan.Zero);
+ recurse(DispatchEnd, TimeSpan.Zero);
break;
- case DISPATCH_END:
+ case DispatchEnd:
//
// If work was due while we were still running user code, the count will have
// been incremented by the periodic tick handler above. In that case, we will
@@ -642,7 +642,7 @@ private void Tick(int command, Action recurse)
//
if (Interlocked.Decrement(ref _pendingTickCount) > 0)
{
- recurse(DISPATCH_START, TimeSpan.Zero);
+ recurse(DispatchStart, TimeSpan.Zero);
}
break;
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs
index f4e2b325de..3df4abb91c 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs
@@ -10,7 +10,7 @@ namespace System.Reactive.Concurrency
//
public static partial class Scheduler
{
- internal static Type[] OPTIMIZATIONS = {
+ internal static Type[] Optimizations = {
typeof(ISchedulerLongRunning),
typeof(IStopwatchProvider),
typeof(ISchedulerPeriodic)
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs
index 48998d39f8..992a69a692 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs
@@ -65,7 +65,7 @@ public static partial class Scheduler
///
/// Gets a scheduler that schedules work on the thread pool.
///
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_THREADPOOL)]
+ [Obsolete(Constants_Core.ObsoleteSchedulerThreadpool)]
public static IScheduler ThreadPool => _threadPool.Value;
private static readonly Lazy _newThread = new Lazy(() => Initialize("NewThread"));
@@ -73,7 +73,7 @@ public static partial class Scheduler
///
/// Gets a scheduler that schedules work on a new thread using default thread creation options.
///
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_NEWTHREAD)]
+ [Obsolete(Constants_Core.ObsoleteSchedulerNewthread)]
public static IScheduler NewThread => _newThread.Value;
private static readonly Lazy _taskPool = new Lazy(() => Initialize("TaskPool"));
@@ -81,7 +81,7 @@ public static partial class Scheduler
///
/// Gets a scheduler that schedules work on Task Parallel Library (TPL) task pool using the default TaskScheduler.
///
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_TASKPOOL)]
+ [Obsolete(Constants_Core.ObsoleteSchedulerTaskpool)]
public static IScheduler TaskPool => _taskPool.Value;
private static IScheduler Initialize(string name)
diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/TaskHelpers.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/TaskHelpers.cs
index 3145083b02..9dcb117d1f 100644
--- a/Rx.NET/Source/src/System.Reactive/Concurrency/TaskHelpers.cs
+++ b/Rx.NET/Source/src/System.Reactive/Concurrency/TaskHelpers.cs
@@ -9,18 +9,18 @@ namespace System.Reactive.Concurrency
{
internal static class TaskHelpers
{
- private const int MAX_DELAY = int.MaxValue;
+ private const int MaxDelay = int.MaxValue;
public static Task Delay(TimeSpan delay, CancellationToken token)
{
var milliseconds = (long)delay.TotalMilliseconds;
- if (milliseconds > MAX_DELAY)
+ if (milliseconds > MaxDelay)
{
- var remainder = delay - TimeSpan.FromMilliseconds(MAX_DELAY);
+ var remainder = delay - TimeSpan.FromMilliseconds(MaxDelay);
return
- Task.Delay(MAX_DELAY, token)
+ Task.Delay(MaxDelay, token)
.ContinueWith(_ => Delay(remainder, token), TaskContinuationOptions.ExecuteSynchronously)
.Unwrap();
}
diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs
index a3212708f7..b1572151fb 100644
--- a/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs
+++ b/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs
@@ -18,11 +18,11 @@ public sealed class CompositeDisposable : ICollection, ICancelable
private bool _disposed;
private List _disposables;
private int _count;
- private const int SHRINK_THRESHOLD = 64;
+ private const int ShrinkThreshold = 64;
// Default initial capacity of the _disposables list in case
// The number of items is not known upfront
- private const int DEFAULT_CAPACITY = 16;
+ private const int DefaultCapacity = 16;
///
/// Initializes a new instance of the class with no disposables contained by it initially.
@@ -85,7 +85,7 @@ public CompositeDisposable(IEnumerable disposables)
else
{
// Unknown sized disposables, use the default capacity hint
- Init(disposables, DEFAULT_CAPACITY);
+ Init(disposables, DefaultCapacity);
}
}
@@ -190,7 +190,7 @@ public bool Remove(IDisposable item)
current[i] = null;
- if (current.Capacity > SHRINK_THRESHOLD && _count < current.Capacity / 2)
+ if (current.Capacity > ShrinkThreshold && _count < current.Capacity / 2)
{
var fresh = new List(current.Capacity / 2);
@@ -357,7 +357,7 @@ public IEnumerator GetEnumerator()
{
if (_disposed || _count == 0)
{
- return EMPTY_ENUMERATOR;
+ return EmptyEnumerator;
}
// the copy is unavoidable but the creation
// of an outer IEnumerable is avoidable
@@ -380,7 +380,7 @@ public IEnumerator GetEnumerator()
/// An empty enumerator for the
/// method to avoid allocation on disposed or empty composites.
///
- private static readonly CompositeEnumerator EMPTY_ENUMERATOR =
+ private static readonly CompositeEnumerator EmptyEnumerator =
new CompositeEnumerator(new IDisposable[0]);
///
diff --git a/Rx.NET/Source/src/System.Reactive/Internal/CheckedObserver.cs b/Rx.NET/Source/src/System.Reactive/Internal/CheckedObserver.cs
index f0aa17f64e..844c4ea64f 100644
--- a/Rx.NET/Source/src/System.Reactive/Internal/CheckedObserver.cs
+++ b/Rx.NET/Source/src/System.Reactive/Internal/CheckedObserver.cs
@@ -11,9 +11,9 @@ internal sealed class CheckedObserver : IObserver
private readonly IObserver _observer;
private int _state;
- private const int IDLE = 0;
- private const int BUSY = 1;
- private const int DONE = 2;
+ private const int Idle = 0;
+ private const int Busy = 1;
+ private const int Done = 2;
public CheckedObserver(IObserver observer)
{
@@ -30,7 +30,7 @@ public void OnNext(T value)
}
finally
{
- Interlocked.Exchange(ref _state, IDLE);
+ Interlocked.Exchange(ref _state, Idle);
}
}
@@ -44,7 +44,7 @@ public void OnError(Exception error)
}
finally
{
- Interlocked.Exchange(ref _state, DONE);
+ Interlocked.Exchange(ref _state, Done);
}
}
@@ -58,17 +58,17 @@ public void OnCompleted()
}
finally
{
- Interlocked.Exchange(ref _state, DONE);
+ Interlocked.Exchange(ref _state, Done);
}
}
private void CheckAccess()
{
- switch (Interlocked.CompareExchange(ref _state, BUSY, IDLE))
+ switch (Interlocked.CompareExchange(ref _state, Busy, Idle))
{
- case BUSY:
+ case Busy:
throw new InvalidOperationException(Strings_Core.REENTRANCY_DETECTED);
- case DONE:
+ case Done:
throw new InvalidOperationException(Strings_Core.OBSERVER_TERMINATED);
}
}
diff --git a/Rx.NET/Source/src/System.Reactive/Internal/Constants.cs b/Rx.NET/Source/src/System.Reactive/Internal/Constants.cs
index a7c93521c1..ea6daa14c5 100644
--- a/Rx.NET/Source/src/System.Reactive/Internal/Constants.cs
+++ b/Rx.NET/Source/src/System.Reactive/Internal/Constants.cs
@@ -8,13 +8,13 @@ namespace System.Reactive
internal static class Constants_Core
{
- private const string OBSOLETE_REFACTORING = "This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies.";
+ private const string ObsoleteRefactoring = "This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies.";
- public const string OBSOLETE_SCHEDULER_NEWTHREAD = OBSOLETE_REFACTORING + " Please use NewThreadScheduler.Default to obtain an instance of this scheduler type.";
- public const string OBSOLETE_SCHEDULER_TASKPOOL = OBSOLETE_REFACTORING + " Please use TaskPoolScheduler.Default to obtain an instance of this scheduler type.";
- public const string OBSOLETE_SCHEDULER_THREADPOOL = OBSOLETE_REFACTORING + " Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace.";
+ public const string ObsoleteSchedulerNewthread = ObsoleteRefactoring + " Please use NewThreadScheduler.Default to obtain an instance of this scheduler type.";
+ public const string ObsoleteSchedulerTaskpool = ObsoleteRefactoring + " Please use TaskPoolScheduler.Default to obtain an instance of this scheduler type.";
+ public const string ObsoleteSchedulerThreadpool = ObsoleteRefactoring + " Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace.";
- public const string OBSOLETE_SCHEDULEREQUIRED = "This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead.";
+ public const string ObsoleteSchedulerequired = "This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead.";
}
// We can't make those based on the Strings_*.resx file, because the ObsoleteAttribute needs a compile-time constant.
@@ -22,8 +22,8 @@ internal static class Constants_Core
internal static class Constants_Linq
{
#if PREFER_ASYNC
- public const string USE_ASYNC = "This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.";
- public const string USE_TASK_FROMASYNCPATTERN = "This conversion is no longer supported. Replace use of the Begin/End asynchronous method pair with a new Task-based async method, and convert the result using ToObservable. If no Task-based async method is available, use Task.Factory.FromAsync to obtain a Task object.";
+ public const string UseAsync = "This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.";
+ public const string UseTaskFromAsyncPattern = "This conversion is no longer supported. Replace use of the Begin/End asynchronous method pair with a new Task-based async method, and convert the result using ToObservable. If no Task-based async method is available, use Task.Factory.FromAsync to obtain a Task object.";
#endif
}
}
diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs b/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs
index 12461f27d6..b21892db34 100644
--- a/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs
+++ b/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs
@@ -14,10 +14,10 @@ namespace System.Reactive
internal class ScheduledObserver : ObserverBase, IScheduledObserver
{
private int _state;
- private const int STOPPED = 0;
- private const int RUNNING = 1;
- private const int PENDING = 2;
- private const int FAULTED = 9;
+ private const int Stopped = 0;
+ private const int Running = 1;
+ private const int Pending = 2;
+ private const int Faulted = 9;
private readonly ConcurrentQueue _queue = new ConcurrentQueue();
private bool _failed;
private Exception _error;
@@ -156,14 +156,14 @@ private void EnsureActiveSlow()
while (true)
{
- var old = Interlocked.CompareExchange(ref _state, RUNNING, STOPPED);
- if (old == STOPPED)
+ var old = Interlocked.CompareExchange(ref _state, Running, Stopped);
+ if (old == Stopped)
{
isOwner = true; // RUNNING
break;
}
- if (old == FAULTED)
+ if (old == Faulted)
{
return;
}
@@ -191,7 +191,7 @@ private void EnsureActiveSlow()
// should only be called after invocation of IObserver methods that touch
// this state.
//
- if (old == PENDING || old == RUNNING && Interlocked.CompareExchange(ref _state, PENDING, RUNNING) == RUNNING)
+ if (old == Pending || old == Running && Interlocked.CompareExchange(ref _state, Pending, Running) == Running)
{
break;
}
@@ -229,7 +229,7 @@ private void Run(object state, Action