diff --git a/ThirdParty/SmartThreadPool/Interfaces.cs b/ThirdParty/SmartThreadPool/Interfaces.cs
index 741b3a1667..b2e19968b4 100644
--- a/ThirdParty/SmartThreadPool/Interfaces.cs
+++ b/ThirdParty/SmartThreadPool/Interfaces.cs
@@ -43,24 +43,6 @@ namespace Amib.Threading
#endregion
- #region WorkItem Priority
-
- ///
- /// Defines the availeable priorities of a work item.
- /// The higher the priority a work item has, the sooner
- /// it will be executed.
- ///
- public enum WorkItemPriority
- {
- Lowest,
- BelowNormal,
- Normal,
- AboveNormal,
- Highest,
- }
-
- #endregion
-
#region IWorkItemsGroup interface
///
@@ -146,6 +128,11 @@ namespace Amib.Threading
#region QueueWorkItem
+ IWorkItemResult QueueWorkItem(WaitCallback callback);
+ IWorkItemResult QueueWorkItem(WaitCallback callback, object state);
+ IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback);
+ IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback, object state);
+
///
/// Queue a work item
///
@@ -153,14 +140,6 @@ namespace Amib.Threading
/// Returns a work item result
IWorkItemResult QueueWorkItem(WorkItemCallback callback);
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- /// The priority of the work item
- /// Returns a work item result
- IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority workItemPriority);
-
///
/// Queue a work item
///
@@ -171,17 +150,6 @@ namespace Amib.Threading
/// Returns a work item result
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state);
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- /// The work item priority
- /// Returns a work item result
- IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority);
-
///
/// Queue a work item
///
@@ -195,19 +163,6 @@ namespace Amib.Threading
/// Returns a work item result
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback);
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// The work item priority
- /// Returns a work item result
- IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, WorkItemPriority workItemPriority);
///
/// Queue a work item
@@ -223,21 +178,6 @@ namespace Amib.Threading
/// Returns a work item result
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute);
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// Indicates on which cases to call to the post execute callback
- /// The work item priority
- /// Returns a work item result
- IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute, WorkItemPriority workItemPriority);
-
///
/// Queue a work item
///
@@ -267,18 +207,6 @@ namespace Amib.Threading
/// Returns a IWorkItemResult object, but its GetResult() will always return null
IWorkItemResult QueueWorkItem(Action action);
- ///
- /// Queue a work item.
- ///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
- IWorkItemResult QueueWorkItem(Action action, WorkItemPriority priority);
-
- ///
- /// Queue a work item.
- ///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
- IWorkItemResult QueueWorkItem(Action action, T arg, WorkItemPriority priority);
-
///
/// Queue a work item.
///
@@ -291,36 +219,18 @@ namespace Amib.Threading
/// Returns a IWorkItemResult object, but its GetResult() will always return null
IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2);
- ///
- /// Queue a work item.
- ///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
- IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, WorkItemPriority priority);
-
///
/// Queue a work item.
///
/// Returns a IWorkItemResult object, but its GetResult() will always return null
IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3);
- ///
- /// Queue a work item.
- ///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
- IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3, WorkItemPriority priority);
-
///
/// Queue a work item.
///
/// Returns a IWorkItemResult object, but its GetResult() will always return null
IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4);
- ///
- /// Queue a work item.
- ///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
- IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4, WorkItemPriority priority);
-
#endregion
#region QueueWorkItem(Func<...>)
@@ -590,11 +500,6 @@ namespace Amib.Threading
/// Returns true if the work item was not completed, otherwise false.
bool Cancel(bool abortExecution);
- ///
- /// Get the work item's priority
- ///
- WorkItemPriority WorkItemPriority { get; }
-
///
/// Return the result, same as GetResult()
///
diff --git a/ThirdParty/SmartThreadPool/InternalInterfaces.cs b/ThirdParty/SmartThreadPool/InternalInterfaces.cs
index 0072e10019..96e80a16bb 100644
--- a/ThirdParty/SmartThreadPool/InternalInterfaces.cs
+++ b/ThirdParty/SmartThreadPool/InternalInterfaces.cs
@@ -19,9 +19,4 @@ namespace Amib.Threading.Internal
///
IWorkItemResult GetWorkItemResult();
}
-
- public interface IHasWorkItemPriority
- {
- WorkItemPriority WorkItemPriority { get; }
- }
}
diff --git a/ThirdParty/SmartThreadPool/PriorityQueue.cs b/ThirdParty/SmartThreadPool/PriorityQueue.cs
deleted file mode 100644
index d0d1efb06c..0000000000
--- a/ThirdParty/SmartThreadPool/PriorityQueue.cs
+++ /dev/null
@@ -1,238 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace Amib.Threading.Internal
-{
- #region PriorityQueue class
-
- ///
- /// PriorityQueue class
- /// This class is not thread safe because we use external lock
- ///
- public sealed class PriorityQueue : IEnumerable
- {
- #region Private members
-
- ///
- /// The number of queues, there is one for each type of priority
- ///
- private const int _queuesCount = WorkItemPriority.Highest-WorkItemPriority.Lowest+1;
-
- ///
- /// Work items queues. There is one for each type of priority
- ///
- private readonly Queue[] _queues = new Queue[_queuesCount];
-
- ///
- /// The total number of work items within the queues
- ///
- private int _workItemsCount;
-
- ///
- /// Use with IEnumerable interface
- ///
- private int _version;
-
- #endregion
-
- #region Contructor
-
- public PriorityQueue()
- {
- for(int i = 0; i < _queues.Length; ++i)
- {
- _queues[i] = new Queue();
- }
- }
-
- #endregion
-
- #region Methods
-
- ///
- /// Enqueue a work item.
- ///
- /// A work item
- public void Enqueue(IHasWorkItemPriority workItem)
- {
- Debug.Assert(null != workItem);
-
- int queueIndex = _queuesCount-(int)workItem.WorkItemPriority-1;
- Debug.Assert(queueIndex >= 0);
- Debug.Assert(queueIndex < _queuesCount);
-
- _queues[queueIndex].Enqueue(workItem);
- ++_workItemsCount;
- ++_version;
- }
-
- ///
- /// Dequeque a work item.
- ///
- /// Returns the next work item
- public IHasWorkItemPriority Dequeue()
- {
- IHasWorkItemPriority workItem = null;
-
- if(_workItemsCount > 0)
- {
- int queueIndex = GetNextNonEmptyQueue(-1);
- Debug.Assert(queueIndex >= 0);
- workItem = _queues[queueIndex].Dequeue();
- Debug.Assert(null != workItem);
- --_workItemsCount;
- ++_version;
- }
-
- return workItem;
- }
-
- ///
- /// Find the next non empty queue starting at queue queueIndex+1
- ///
- /// The index-1 to start from
- ///
- /// The index of the next non empty queue or -1 if all the queues are empty
- ///
- private int GetNextNonEmptyQueue(int queueIndex)
- {
- for(int i = queueIndex+1; i < _queuesCount; ++i)
- {
- if(_queues[i].Count > 0)
- {
- return i;
- }
- }
- return -1;
- }
-
- ///
- /// The number of work items
- ///
- public int Count
- {
- get
- {
- return _workItemsCount;
- }
- }
-
- ///
- /// Clear all the work items
- ///
- public void Clear()
- {
- if (_workItemsCount > 0)
- {
- foreach(Queue queue in _queues)
- {
- queue.Clear();
- }
- _workItemsCount = 0;
- ++_version;
- }
- }
-
- #endregion
-
- #region IEnumerable Members
-
- ///
- /// Returns an enumerator to iterate over the work items
- ///
- /// Returns an enumerator
- public IEnumerator GetEnumerator()
- {
- return new PriorityQueueEnumerator(this);
- }
-
- #endregion
-
- #region PriorityQueueEnumerator
-
- ///
- /// The class the implements the enumerator
- ///
- private class PriorityQueueEnumerator : IEnumerator
- {
- private readonly PriorityQueue _priorityQueue;
- private int _version;
- private int _queueIndex;
- private IEnumerator _enumerator;
-
- public PriorityQueueEnumerator(PriorityQueue priorityQueue)
- {
- _priorityQueue = priorityQueue;
- _version = _priorityQueue._version;
- _queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
- if (_queueIndex >= 0)
- {
- _enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
- }
- else
- {
- _enumerator = null;
- }
- }
-
- #region IEnumerator Members
-
- public void Reset()
- {
- _version = _priorityQueue._version;
- _queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
- if (_queueIndex >= 0)
- {
- _enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
- }
- else
- {
- _enumerator = null;
- }
- }
-
- public object Current
- {
- get
- {
- Debug.Assert(null != _enumerator);
- return _enumerator.Current;
- }
- }
-
- public bool MoveNext()
- {
- if (null == _enumerator)
- {
- return false;
- }
-
- if(_version != _priorityQueue._version)
- {
- throw new InvalidOperationException("The collection has been modified");
-
- }
- if (!_enumerator.MoveNext())
- {
- _queueIndex = _priorityQueue.GetNextNonEmptyQueue(_queueIndex);
- if(-1 == _queueIndex)
- {
- return false;
- }
- _enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
- _enumerator.MoveNext();
- return true;
- }
- return true;
- }
-
- #endregion
- }
-
- #endregion
- }
-
- #endregion
-}
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index 655bd65bb9..2947d82ac6 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -151,11 +151,6 @@ namespace Amib.Threading
///
public static readonly PostExecuteWorkItemCallback DefaultPostExecuteWorkItemCallback;
- ///
- /// The default work item priority (WorkItemPriority.Normal)
- ///
- public const WorkItemPriority DefaultWorkItemPriority = WorkItemPriority.Normal;
-
///
/// The default is to work on work items as soon as they arrive
/// and not to wait for the start. (false)
diff --git a/ThirdParty/SmartThreadPool/WIGStartInfo.cs b/ThirdParty/SmartThreadPool/WIGStartInfo.cs
index c812dbe6e3..a5faad241b 100644
--- a/ThirdParty/SmartThreadPool/WIGStartInfo.cs
+++ b/ThirdParty/SmartThreadPool/WIGStartInfo.cs
@@ -12,7 +12,6 @@ namespace Amib.Threading
private CallToPostExecute _callToPostExecute;
private PostExecuteWorkItemCallback _postExecuteWorkItemCallback;
private bool _startSuspended;
- private WorkItemPriority _workItemPriority;
private bool _fillStateWithArgs;
protected bool _readOnly;
@@ -20,7 +19,6 @@ namespace Amib.Threading
public WIGStartInfo()
{
_fillStateWithArgs = SmartThreadPool.DefaultFillStateWithArgs;
- _workItemPriority = SmartThreadPool.DefaultWorkItemPriority;
_startSuspended = SmartThreadPool.DefaultStartSuspended;
_postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
_callToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
@@ -34,7 +32,6 @@ namespace Amib.Threading
_disposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
_callToPostExecute = wigStartInfo.CallToPostExecute;
_postExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback;
- _workItemPriority = wigStartInfo.WorkItemPriority;
_startSuspended = wigStartInfo.StartSuspended;
_fillStateWithArgs = wigStartInfo.FillStateWithArgs;
}
@@ -117,16 +114,6 @@ namespace Amib.Threading
}
}
-
- ///
- /// Get/Set the default priority that a work item gets when it is enqueued
- ///
- public virtual WorkItemPriority WorkItemPriority
- {
- get { return _workItemPriority; }
- set { _workItemPriority = value; }
- }
-
///
/// Get/Set the if QueueWorkItem of Action<...>/Func<...> fill the
/// arguments as an object array into the state of the work item.
diff --git a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs b/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs
index 435a14bf2e..2d2ac61bfa 100644
--- a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs
+++ b/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs
@@ -112,14 +112,6 @@ namespace Amib.Threading.Internal
}
}
- public WorkItemPriority WorkItemPriority
- {
- get
- {
- return _workItem._workItemInfo.WorkItemPriority;
- }
- }
-
///
/// Return the result, same as GetResult()
///
diff --git a/ThirdParty/SmartThreadPool/WorkItem.cs b/ThirdParty/SmartThreadPool/WorkItem.cs
index 7df3f580e2..5b2eec9743 100644
--- a/ThirdParty/SmartThreadPool/WorkItem.cs
+++ b/ThirdParty/SmartThreadPool/WorkItem.cs
@@ -7,7 +7,7 @@ namespace Amib.Threading.Internal
///
/// Holds a callback delegate and the state for that delegate.
///
- public partial class WorkItem : IHasWorkItemPriority
+ public partial class WorkItem
{
#region WorkItemState enum
@@ -955,22 +955,7 @@ namespace Amib.Threading.Internal
}
#endregion
-
- #region IHasWorkItemPriority Members
-
- ///
- /// Returns the priority of the work item
- ///
- public WorkItemPriority WorkItemPriority
- {
- get
- {
- return _workItemInfo.WorkItemPriority;
- }
- }
-
- #endregion
-
+
internal event WorkItemStateCallback OnWorkItemStarted
{
add
diff --git a/ThirdParty/SmartThreadPool/WorkItemFactory.cs b/ThirdParty/SmartThreadPool/WorkItemFactory.cs
index 4bcf5efd84..8f17706482 100644
--- a/ThirdParty/SmartThreadPool/WorkItemFactory.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemFactory.cs
@@ -34,7 +34,6 @@ namespace Amib.Threading.Internal
PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback,
CallToPostExecute = wigStartInfo.CallToPostExecute,
DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects,
- WorkItemPriority = wigStartInfo.WorkItemPriority
};
WorkItem workItem = new WorkItem(
@@ -57,20 +56,6 @@ namespace Amib.Threading.Internal
return CreateWorkItem(workItemsGroup, wigStartInfo, callback, null);
}
- ///
- /// Create a new work item
- ///
- /// The WorkItemsGroup of this workitem
- /// Work item group start information
- /// A callback to execute
- /// The priority of the work item
- /// Returns a work item
- public static WorkItem CreateWorkItem( IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo,
- WorkItemCallback callback, WorkItemPriority workItemPriority)
- {
- return CreateWorkItem(workItemsGroup, wigStartInfo, callback, null, workItemPriority);
- }
-
///
/// Create a new work item
///
@@ -111,7 +96,6 @@ namespace Amib.Threading.Internal
PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback,
CallToPostExecute = wigStartInfo.CallToPostExecute,
DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects,
- WorkItemPriority = wigStartInfo.WorkItemPriority
};
WorkItem workItem = new WorkItem(
@@ -122,42 +106,6 @@ namespace Amib.Threading.Internal
return workItem;
}
- ///
- /// Create a new work item
- ///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- /// The work item priority
- /// Returns a work item
- public static WorkItem CreateWorkItem(
- IWorkItemsGroup workItemsGroup,
- WIGStartInfo wigStartInfo,
- WorkItemCallback callback,
- object state,
- WorkItemPriority workItemPriority)
- {
- ValidateCallback(callback);
-
- WorkItemInfo workItemInfo = new WorkItemInfo();
- workItemInfo.UseCallerCallContext = wigStartInfo.UseCallerCallContext;
- workItemInfo.PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback;
- workItemInfo.CallToPostExecute = wigStartInfo.CallToPostExecute;
- workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
- workItemInfo.WorkItemPriority = workItemPriority;
-
- WorkItem workItem = new WorkItem(
- workItemsGroup,
- workItemInfo,
- callback,
- state);
-
- return workItem;
- }
-
///
/// Create a new work item
///
@@ -212,48 +160,6 @@ namespace Amib.Threading.Internal
workItemInfo.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
workItemInfo.CallToPostExecute = wigStartInfo.CallToPostExecute;
workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
- workItemInfo.WorkItemPriority = wigStartInfo.WorkItemPriority;
-
- WorkItem workItem = new WorkItem(
- workItemsGroup,
- workItemInfo,
- callback,
- state);
-
- return workItem;
- }
-
- ///
- /// Create a new work item
- ///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// The work item priority
- /// Returns a work item
- public static WorkItem CreateWorkItem(
- IWorkItemsGroup workItemsGroup,
- WIGStartInfo wigStartInfo,
- WorkItemCallback callback,
- object state,
- PostExecuteWorkItemCallback postExecuteWorkItemCallback,
- WorkItemPriority workItemPriority)
- {
- ValidateCallback(callback);
- ValidateCallback(postExecuteWorkItemCallback);
-
- WorkItemInfo workItemInfo = new WorkItemInfo();
- workItemInfo.UseCallerCallContext = wigStartInfo.UseCallerCallContext;
- workItemInfo.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
- workItemInfo.CallToPostExecute = wigStartInfo.CallToPostExecute;
- workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
- workItemInfo.WorkItemPriority = workItemPriority;
WorkItem workItem = new WorkItem(
workItemsGroup,
@@ -294,7 +200,6 @@ namespace Amib.Threading.Internal
workItemInfo.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
workItemInfo.CallToPostExecute = callToPostExecute;
workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
- workItemInfo.WorkItemPriority = wigStartInfo.WorkItemPriority;
WorkItem workItem = new WorkItem(
workItemsGroup,
@@ -305,50 +210,6 @@ namespace Amib.Threading.Internal
return workItem;
}
- ///
- /// Create a new work item
- ///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// Indicates on which cases to call to the post execute callback
- /// The work item priority
- /// Returns a work item
- public static WorkItem CreateWorkItem(
- IWorkItemsGroup workItemsGroup,
- WIGStartInfo wigStartInfo,
- WorkItemCallback callback,
- object state,
- PostExecuteWorkItemCallback postExecuteWorkItemCallback,
- CallToPostExecute callToPostExecute,
- WorkItemPriority workItemPriority)
- {
-
- ValidateCallback(callback);
- ValidateCallback(postExecuteWorkItemCallback);
-
- WorkItemInfo workItemInfo = new WorkItemInfo();
- workItemInfo.UseCallerCallContext = wigStartInfo.UseCallerCallContext;
- workItemInfo.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
- workItemInfo.CallToPostExecute = callToPostExecute;
- workItemInfo.WorkItemPriority = workItemPriority;
- workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
-
- WorkItem workItem = new WorkItem(
- workItemsGroup,
- workItemInfo,
- callback,
- state);
-
- return workItem;
- }
-
private static void ValidateCallback(Delegate callback)
{
if (callback != null && callback.GetInvocationList().Length > 1)
diff --git a/ThirdParty/SmartThreadPool/WorkItemInfo.cs b/ThirdParty/SmartThreadPool/WorkItemInfo.cs
index 4d82e2a804..405ac5d360 100644
--- a/ThirdParty/SmartThreadPool/WorkItemInfo.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemInfo.cs
@@ -13,7 +13,6 @@ namespace Amib.Threading
DisposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
CallToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
PostExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
- WorkItemPriority = SmartThreadPool.DefaultWorkItemPriority;
}
public WorkItemInfo(WorkItemInfo workItemInfo)
@@ -22,7 +21,6 @@ namespace Amib.Threading
DisposeOfStateObjects = workItemInfo.DisposeOfStateObjects;
CallToPostExecute = workItemInfo.CallToPostExecute;
PostExecuteWorkItemCallback = workItemInfo.PostExecuteWorkItemCallback;
- WorkItemPriority = workItemInfo.WorkItemPriority;
Timeout = workItemInfo.Timeout;
}
@@ -46,11 +44,6 @@ namespace Amib.Threading
///
public PostExecuteWorkItemCallback PostExecuteWorkItemCallback { get; set; }
- ///
- /// Get/Set the work item's priority
- ///
- public WorkItemPriority WorkItemPriority { get; set; }
-
///
/// Get/Set the work item's timout in milliseconds.
/// This is a passive timout. When the timout expires the work item won't be actively aborted!
diff --git a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs b/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs
index d1eff95184..45d11ea15c 100644
--- a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs
@@ -91,11 +91,6 @@ namespace Amib.Threading.Internal
return _workItemResult.Cancel(abortExecution);
}
- public WorkItemPriority WorkItemPriority
- {
- get { return _workItemResult.WorkItemPriority; }
- }
-
public TResult Result
{
get { return (TResult)_workItemResult.Result; }
diff --git a/ThirdParty/SmartThreadPool/WorkItemsGroup.cs b/ThirdParty/SmartThreadPool/WorkItemsGroup.cs
index 06b5c44fa7..f5fba4b537 100644
--- a/ThirdParty/SmartThreadPool/WorkItemsGroup.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemsGroup.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Diagnostics;
@@ -42,7 +43,7 @@ namespace Amib.Threading.Internal
/// Priority queue to hold work items before they are passed
/// to the SmartThreadPool.
///
- private readonly PriorityQueue _workItemsQueue;
+ private readonly Queue _workItemsQueue;
///
/// Indicate how many work items are waiting in the SmartThreadPool
@@ -93,7 +94,7 @@ namespace Amib.Threading.Internal
_stp = stp;
_concurrency = concurrency;
_workItemsGroupStartInfo = new WIGStartInfo(wigStartInfo).AsReadOnly();
- _workItemsQueue = new PriorityQueue();
+ _workItemsQueue = new Queue();
Name = "WorkItemsGroup";
// The _workItemsInStpQueue gets the number of currently executing work items,
diff --git a/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs b/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs
index 7e277f1c1d..473adc3645 100644
--- a/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs
@@ -128,20 +128,6 @@ namespace Amib.Threading.Internal
return workItem.GetWorkItemResult();
}
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- /// The priority of the work item
- /// Returns a work item result
- public IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority workItemPriority)
- {
- PreQueueWorkItem();
- WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, workItemPriority);
- Enqueue(workItem);
- return workItem.GetWorkItemResult();
- }
-
///
/// Queue a work item
///
@@ -171,23 +157,6 @@ namespace Amib.Threading.Internal
return workItem.GetWorkItemResult();
}
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- /// The work item priority
- /// Returns a work item result
- public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority)
- {
- PreQueueWorkItem();
- WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, workItemPriority);
- Enqueue(workItem);
- return workItem.GetWorkItemResult();
- }
-
///
/// Queue a work item
///
@@ -225,26 +194,6 @@ namespace Amib.Threading.Internal
return workItem.GetWorkItemResult();
}
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// The work item priority
- /// Returns a work item result
- public IWorkItemResult QueueWorkItem( WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback,
- WorkItemPriority workItemPriority)
- {
- PreQueueWorkItem();
- WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, postExecuteWorkItemCallback, workItemPriority);
- Enqueue(workItem);
- return workItem.GetWorkItemResult();
- }
///
/// Queue a work item
@@ -267,39 +216,11 @@ namespace Amib.Threading.Internal
return workItem.GetWorkItemResult();
}
- ///
- /// Queue a work item
- ///
- /// A callback to execute
- ///
- /// The context object of the work item. Used for passing arguments to the work item.
- ///
- ///
- /// A delegate to call after the callback completion
- ///
- /// Indicates on which cases to call to the post execute callback
- /// The work item priority
- /// Returns a work item result
- public IWorkItemResult QueueWorkItem( WorkItemCallback callback, object state,
- PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute,
- WorkItemPriority workItemPriority)
- {
- PreQueueWorkItem();
- WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, postExecuteWorkItemCallback, callToPostExecute, workItemPriority);
- Enqueue(workItem);
- return workItem.GetWorkItemResult();
- }
-
#endregion
#region QueueWorkItem(Action<...>)
- public IWorkItemResult QueueWorkItem(Action action)
- {
- return QueueWorkItem (action, SmartThreadPool.DefaultWorkItemPriority);
- }
-
- public IWorkItemResult QueueWorkItem (Action action, WorkItemPriority priority)
+ public IWorkItemResult QueueWorkItem (Action action)
{
PreQueueWorkItem ();
WorkItem workItem = WorkItemFactory.CreateWorkItem (
@@ -309,17 +230,12 @@ namespace Amib.Threading.Internal
{
action.Invoke ();
return null;
- }, priority);
+ });
Enqueue (workItem);
return workItem.GetWorkItemResult ();
}
- public IWorkItemResult QueueWorkItem(Action action, T arg)
- {
- return QueueWorkItem (action, arg, SmartThreadPool.DefaultWorkItemPriority);
- }
-
- public IWorkItemResult QueueWorkItem (Action action, T arg, WorkItemPriority priority)
+ public IWorkItemResult QueueWorkItem (Action action, T arg)
{
PreQueueWorkItem ();
WorkItem workItem = WorkItemFactory.CreateWorkItem (
@@ -330,17 +246,12 @@ namespace Amib.Threading.Internal
action.Invoke (arg);
return null;
},
- WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null, priority);
+ WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null);
Enqueue (workItem);
return workItem.GetWorkItemResult ();
}
- public IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2)
- {
- return QueueWorkItem (action, arg1, arg2, SmartThreadPool.DefaultWorkItemPriority);
- }
-
- public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2, WorkItemPriority priority)
+ public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2)
{
PreQueueWorkItem ();
WorkItem workItem = WorkItemFactory.CreateWorkItem (
@@ -351,18 +262,12 @@ namespace Amib.Threading.Internal
action.Invoke (arg1, arg2);
return null;
},
- WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null, priority);
+ WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null);
Enqueue (workItem);
return workItem.GetWorkItemResult ();
}
- public IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3)
- {
- return QueueWorkItem (action, arg1, arg2, arg3, SmartThreadPool.DefaultWorkItemPriority);
- ;
- }
-
- public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2, T3 arg3, WorkItemPriority priority)
+ public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2, T3 arg3)
{
PreQueueWorkItem ();
WorkItem workItem = WorkItemFactory.CreateWorkItem (
@@ -373,20 +278,13 @@ namespace Amib.Threading.Internal
action.Invoke (arg1, arg2, arg3);
return null;
},
- WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null, priority);
+ WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null);
Enqueue (workItem);
return workItem.GetWorkItemResult ();
}
- public IWorkItemResult QueueWorkItem(
- Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
- {
- return QueueWorkItem (action, arg1, arg2, arg3, arg4,
- SmartThreadPool.DefaultWorkItemPriority);
- }
-
public IWorkItemResult QueueWorkItem (
- Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4, WorkItemPriority priority)
+ Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
{
PreQueueWorkItem ();
WorkItem workItem = WorkItemFactory.CreateWorkItem (
@@ -397,7 +295,7 @@ namespace Amib.Threading.Internal
action.Invoke (arg1, arg2, arg3, arg4);
return null;
},
- WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null, priority);
+ WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null);
Enqueue (workItem);
return workItem.GetWorkItemResult ();
}
diff --git a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
index 89eb96c3c5..670a2e7a43 100644
--- a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs
@@ -26,7 +26,7 @@ namespace Amib.Threading.Internal
///
/// Work items queue
///
- private readonly PriorityQueue _workItems = new PriorityQueue();
+ private readonly Queue _workItems = new Queue();
///
/// Indicate that work items are allowed to be queued
@@ -166,7 +166,7 @@ namespace Amib.Threading.Internal
// If there are waiting work items then take one and return.
if (_workItems.Count > 0)
{
- workItem = _workItems.Dequeue() as WorkItem;
+ workItem = _workItems.Dequeue();
return workItem;
}
@@ -224,7 +224,7 @@ namespace Amib.Threading.Internal
if (null == workItem)
{
- workItem = _workItems.Dequeue() as WorkItem;
+ workItem = _workItems.Dequeue();
}
}
}