mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
closes #671 and changes to aborting thread in Dispose instead of attempting to join
This commit is contained in:
@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.Core.Queues
|
|||||||
protected readonly CrestronQueue<IQueueMessage> _queue;
|
protected readonly CrestronQueue<IQueueMessage> _queue;
|
||||||
protected readonly Thread _worker;
|
protected readonly Thread _worker;
|
||||||
protected readonly CEvent _waitHandle = new CEvent();
|
protected readonly CEvent _waitHandle = new CEvent();
|
||||||
|
|
||||||
private bool _delayEnabled;
|
private bool _delayEnabled;
|
||||||
private int _delayTime;
|
private int _delayTime;
|
||||||
|
|
||||||
@@ -150,15 +150,15 @@ namespace PepperDash.Essentials.Core.Queues
|
|||||||
_delayEnabled = pacing > 0;
|
_delayEnabled = pacing > 0;
|
||||||
_delayTime = pacing;
|
_delayTime = pacing;
|
||||||
|
|
||||||
//CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||||
//{
|
{
|
||||||
// if (programEvent != eProgramStatusEventType.Stopping)
|
if (programEvent != eProgramStatusEventType.Stopping)
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
// Dispose(true);
|
Dispose(true);
|
||||||
//};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thread callback
|
/// Thread callback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -231,10 +231,13 @@ namespace PepperDash.Essentials.Core.Queues
|
|||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Disposing...");
|
Debug.Console(2, this, "Disposing...");
|
||||||
_queue.Clear();
|
if (_queue != null && !_queue.Disposed)
|
||||||
Enqueue(null);
|
{
|
||||||
_worker.Join();
|
_queue.Clear();
|
||||||
|
Enqueue(null);
|
||||||
|
}
|
||||||
|
_worker.Abort();
|
||||||
_waitHandle.Close();
|
_waitHandle.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +246,7 @@ namespace PepperDash.Essentials.Core.Queues
|
|||||||
|
|
||||||
~GenericQueue()
|
~GenericQueue()
|
||||||
{
|
{
|
||||||
Dispose(false);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -404,13 +407,13 @@ namespace PepperDash_Essentials_Core.Queues
|
|||||||
_delayEnabled = pacing > 0;
|
_delayEnabled = pacing > 0;
|
||||||
_delayTime = pacing;
|
_delayTime = pacing;
|
||||||
|
|
||||||
//CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||||
//{
|
{
|
||||||
// if (programEvent != eProgramStatusEventType.Stopping)
|
if (programEvent != eProgramStatusEventType.Stopping)
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
// Dispose(true);
|
Dispose(true);
|
||||||
//};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -479,10 +482,13 @@ namespace PepperDash_Essentials_Core.Queues
|
|||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Disposing...");
|
Debug.Console(2, this, "Disposing...");
|
||||||
_queue.Clear();
|
if (_queue != null && !_queue.Disposed)
|
||||||
Enqueue(null);
|
{
|
||||||
_worker.Join();
|
_queue.Clear();
|
||||||
|
Enqueue(null);
|
||||||
|
}
|
||||||
|
_worker.Abort();
|
||||||
_waitHandle.Close();
|
_waitHandle.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,7 +497,7 @@ namespace PepperDash_Essentials_Core.Queues
|
|||||||
|
|
||||||
~GenericQueue()
|
~GenericQueue()
|
||||||
{
|
{
|
||||||
Dispose(false);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user