diff --git a/ThirdParty/SmartThreadPool/PriorityQueue.cs b/ThirdParty/SmartThreadPool/PriorityQueue.cs
index ce04751bbd..d0d1efb06c 100644
--- a/ThirdParty/SmartThreadPool/PriorityQueue.cs
+++ b/ThirdParty/SmartThreadPool/PriorityQueue.cs
@@ -23,7 +23,7 @@ namespace Amib.Threading.Internal
///
/// Work items queues. There is one for each type of priority
///
- private readonly LinkedList[] _queues = new LinkedList[_queuesCount];
+ private readonly Queue[] _queues = new Queue[_queuesCount];
///
/// The total number of work items within the queues
@@ -43,7 +43,7 @@ namespace Amib.Threading.Internal
{
for(int i = 0; i < _queues.Length; ++i)
{
- _queues[i] = new LinkedList();
+ _queues[i] = new Queue();
}
}
@@ -63,7 +63,7 @@ namespace Amib.Threading.Internal
Debug.Assert(queueIndex >= 0);
Debug.Assert(queueIndex < _queuesCount);
- _queues[queueIndex].AddLast(workItem);
+ _queues[queueIndex].Enqueue(workItem);
++_workItemsCount;
++_version;
}
@@ -80,8 +80,7 @@ namespace Amib.Threading.Internal
{
int queueIndex = GetNextNonEmptyQueue(-1);
Debug.Assert(queueIndex >= 0);
- workItem = _queues[queueIndex].First.Value;
- _queues[queueIndex].RemoveFirst();
+ workItem = _queues[queueIndex].Dequeue();
Debug.Assert(null != workItem);
--_workItemsCount;
++_version;
@@ -127,7 +126,7 @@ namespace Amib.Threading.Internal
{
if (_workItemsCount > 0)
{
- foreach(LinkedList queue in _queues)
+ foreach(Queue queue in _queues)
{
queue.Clear();
}
diff --git a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
index 6a6e039241..89eb96c3c5 100644
--- a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
@@ -143,9 +143,7 @@ namespace Amib.Threading.Internal
/// Timeout in milliseconds
/// Cancel wait handle
/// Returns true if the resource was granted
- public WorkItem DequeueWorkItem(
- int millisecondsTimeout,
- WaitHandle cancelEvent)
+ public WorkItem DequeueWorkItem( int millisecondsTimeout, WaitHandle cancelEvent)
{
// This method cause the caller to wait for a work item.
// If there is at least one waiting work item then the
@@ -182,9 +180,7 @@ namespace Amib.Threading.Internal
}
// Prepare array of wait handle for the WaitHandle.WaitAny()
- WaitHandle[] waitHandles = new WaitHandle[] {
- waiterEntry.WaitHandle,
- cancelEvent };
+ WaitHandle[] waitHandles = new WaitHandle[] { waiterEntry.WaitHandle, cancelEvent };
// Wait for an available resource, cancel event, or timeout.
@@ -193,10 +189,7 @@ namespace Amib.Threading.Internal
// It just doesn't work, I don't know why, so I have two lock(this)
// statments instead of one.
- int index = STPEventWaitHandle.WaitAny(
- waitHandles,
- millisecondsTimeout,
- true);
+ int index = STPEventWaitHandle.WaitAny( waitHandles, millisecondsTimeout, true);
lock (this)
{