diff --git a/PerfectNumbers.Core/Gpu/GpuPrimeWorkLimiter.cs b/PerfectNumbers.Core/Gpu/GpuPrimeWorkLimiter.cs index 4975e1d..8b328ed 100644 --- a/PerfectNumbers.Core/Gpu/GpuPrimeWorkLimiter.cs +++ b/PerfectNumbers.Core/Gpu/GpuPrimeWorkLimiter.cs @@ -12,22 +12,22 @@ public static class GpuPrimeWorkLimiter public static int CurrentLimit => _currentLimit; public static void SetLimit(int value) - { - if (value <= 0) - { - value = 1; - } + { + if (value <= 0) + { + value = 1; + } - if (value == _currentLimit) - { - return; + if (value == _currentLimit) + { + return; + } + + // TODO: Switch to a shared limiter implementation with GpuWorkLimiter so we can coordinate CPU/GPU prime work using + // the same semaphore pool without reallocating per adjustment. + // var previous = _semaphore; + _semaphore = new PollingSemaphore(value, _pauseBetweenChecks); + _currentLimit = value; + // previous.Dispose(); } - - // TODO: Switch to a shared limiter implementation with GpuWorkLimiter so we can coordinate CPU/GPU prime work using - // the same semaphore pool without reallocating per adjustment. - // var previous = _semaphore; - _semaphore = new PollingSemaphore(value, _pauseBetweenChecks); - _currentLimit = value; - // previous.Dispose(); - } }