From 2feec6205285d82a961eb9c64ec908b4255cd8d5 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 31 Mar 2021 16:35:33 -0600 Subject: [PATCH] Removes explicit call to dispose when program stops. Clears queue in dispose --- .../Queues/GenericQueue.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Queues/GenericQueue.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Queues/GenericQueue.cs index 36f69e0f..f2e8000d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Queues/GenericQueue.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Queues/GenericQueue.cs @@ -150,13 +150,13 @@ namespace PepperDash.Essentials.Core.Queues _delayEnabled = pacing > 0; _delayTime = pacing; - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; + //CrestronEnvironment.ProgramStatusEventHandler += programEvent => + //{ + // if (programEvent != eProgramStatusEventType.Stopping) + // return; - Dispose(true); - }; + // Dispose(true); + //}; } /// @@ -231,6 +231,8 @@ namespace PepperDash.Essentials.Core.Queues if (disposing) { + Debug.Console(2, this, "Disposing..."); + _queue.Clear(); Enqueue(null); _worker.Join(); _waitHandle.Close(); @@ -402,13 +404,13 @@ namespace PepperDash_Essentials_Core.Queues _delayEnabled = pacing > 0; _delayTime = pacing; - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; + //CrestronEnvironment.ProgramStatusEventHandler += programEvent => + //{ + // if (programEvent != eProgramStatusEventType.Stopping) + // return; - Dispose(true); - }; + // Dispose(true); + //}; } /// @@ -477,6 +479,8 @@ namespace PepperDash_Essentials_Core.Queues if (disposing) { + Debug.Console(2, this, "Disposing..."); + _queue.Clear(); Enqueue(null); _worker.Join(); _waitHandle.Close();