diff --git a/SmartThreadPool/Exceptions.cs b/SmartThreadPool/Exceptions.cs
index ae938b7..80796a3 100644
--- a/SmartThreadPool/Exceptions.cs
+++ b/SmartThreadPool/Exceptions.cs
@@ -6,7 +6,7 @@ namespace Amib.Threading
#region Exceptions
///
- /// Represents an exception in case IWorkItemResult.GetResult has been canceled
+ /// Represents an exception in case IWorkItemResult.GetResult has been canceled.
///
public sealed partial class WorkItemCancelException : Exception
{
@@ -26,7 +26,7 @@ public WorkItemCancelException(string message, Exception e)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been timed out
+ /// Represents an exception in case IWorkItemResult.GetResult has been timed out.
///
public sealed partial class WorkItemTimeoutException : Exception
{
@@ -46,7 +46,7 @@ public WorkItemTimeoutException(string message, Exception e)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been timed out
+ /// Represents an exception in case IWorkItemResult.GetResult has been timed out.
///
public sealed partial class WorkItemResultException : Exception
{
@@ -68,7 +68,7 @@ public WorkItemResultException(string message, Exception e)
///
/// Represents an exception in case the STP queue is full and work item cannot be queued.
- /// Relevant when the STP has a queue size limit
+ /// Relevant when the STP has a queue size limit.
///
public sealed partial class QueueRejectedException : Exception
{
@@ -88,7 +88,7 @@ public QueueRejectedException(string message, Exception e)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been canceled
+ /// Represents an exception in case IWorkItemResult.GetResult has been canceled.
///
[Serializable]
public sealed partial class WorkItemCancelException
@@ -100,7 +100,7 @@ public WorkItemCancelException(SerializationInfo si, StreamingContext sc)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been timed out
+ /// Represents an exception in case IWorkItemResult.GetResult has been timed out.
///
[Serializable]
public sealed partial class WorkItemTimeoutException
@@ -112,7 +112,7 @@ public WorkItemTimeoutException(SerializationInfo si, StreamingContext sc)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been timed out
+ /// Represents an exception in case IWorkItemResult.GetResult has been timed out.
///
[Serializable]
public sealed partial class WorkItemResultException
@@ -124,7 +124,7 @@ public WorkItemResultException(SerializationInfo si, StreamingContext sc)
}
///
- /// Represents an exception in case IWorkItemResult.GetResult has been timed out
+ /// Represents an exception in case IWorkItemResult.GetResult has been timed out.
///
[Serializable]
public sealed partial class QueueRejectedException
diff --git a/SmartThreadPool/Interfaces.cs b/SmartThreadPool/Interfaces.cs
index ed9622e..f4df377 100644
--- a/SmartThreadPool/Interfaces.cs
+++ b/SmartThreadPool/Interfaces.cs
@@ -65,17 +65,17 @@ public enum WorkItemPriority
///
/// IWorkItemsGroup interface
- /// Created by SmartThreadPool.CreateWorkItemsGroup()
+ /// Created by SmartThreadPool.CreateWorkItemsGroup().
///
public interface IWorkItemsGroup
{
///
- /// Get/Set the name of the WorkItemsGroup
+ /// Get/Set the name of the WorkItemsGroup.
///
string Name { get; set; }
///
- /// Get/Set the maximum number of workitem that execute cocurrency on the thread pool
+ /// Get/Set the maximum number of work items that execute concurrency on the thread pool.
///
int Concurrency { get; set; }
@@ -85,7 +85,7 @@ public interface IWorkItemsGroup
int WaitingCallbacks { get; }
///
- /// Get the number of currently executing work items
+ /// Get the number of currently executing work items.
///
int InUseThreads { get; }
@@ -96,25 +96,25 @@ public interface IWorkItemsGroup
object[] GetStates();
///
- /// Get the WorkItemsGroup start information
+ /// Get the WorkItemsGroup start information.
///
WIGStartInfo WIGStartInfo { get; }
///
- /// Starts to execute work items
+ /// Starts to execute work items.
///
void Start();
///
/// Cancel all the work items.
- /// Same as Cancel(false)
+ /// Same as Cancel(false).
///
void Cancel();
///
- /// Cancel all work items using thread abortion
+ /// Cancel all work items using thread abortion.
///
- /// True to stop work items by raising ThreadAbortException
+ /// True to stop work items by raising ThreadAbortException.
void Cancel(bool abortExecution);
///
@@ -123,16 +123,16 @@ public interface IWorkItemsGroup
void WaitForIdle();
///
- /// Wait for all work item to complete, until timeout expired
+ /// Wait for all work item to complete, until timeout expired.
///
- /// How long to wait for the work items to complete
+ /// How long to wait for the work items to complete.
/// Returns true if work items completed within the timeout, otherwise false.
bool WaitForIdle(TimeSpan timeout);
///
- /// Wait for all work item to complete, until timeout expired
+ /// Wait for all work item to complete, until timeout expired.
///
- /// How long to wait for the work items to complete in milliseconds
+ /// How long to wait for the work items to complete in milliseconds.
/// Returns true if work items completed within the timeout, otherwise false.
bool WaitForIdle(int millisecondsTimeout);
@@ -152,110 +152,110 @@ public interface IWorkItemsGroup
#region QueueWorkItem
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
- /// Returns a work item result
+ /// A callback to execute.
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
- /// The priority of the work item
- /// Returns a work item result
+ /// 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
+ /// Queue a work item.
///
- /// A callback to execute
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
- /// Returns a work item result
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// The work item priority.
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Returns a work item result
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// The work item priority
- /// Returns a work item result
+ /// The work item priority.
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, WorkItemPriority workItemPriority);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Indicates on which cases to call to the post execute callback
- /// Returns a work item result
+ /// Indicates on which cases to call to the post execute callback.
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// 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
+ /// 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
+ /// Queue a work item.
///
- /// Work item info
- /// A callback to execute
- /// Returns a work item result
+ /// Work item info.
+ /// A callback to execute.
+ /// Returns a work item result.
IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback);
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// Work item information
- /// A callback to execute
+ /// Work item information.
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
@@ -269,19 +269,19 @@ public interface IWorkItemsGroup
///
/// Queue a work item.
///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
+ /// Returns a IWorkItemResult object, but its GetResult() will always return null.
IWorkItemResult QueueWorkItem(Action action, WorkItemPriority priority = SmartThreadPool.DefaultWorkItemPriority);
///
/// Queue a work item.
///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
+ /// Returns a IWorkItemResult object, but its GetResult() will always return null.
IWorkItemResult QueueWorkItem(Action action, T arg, WorkItemPriority priority = SmartThreadPool.DefaultWorkItemPriority);
///
/// Queue a work item.
///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
+ /// Returns a IWorkItemResult object, but its GetResult() will always return null.
IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, WorkItemPriority priority = SmartThreadPool.DefaultWorkItemPriority);
///
@@ -293,7 +293,7 @@ public interface IWorkItemsGroup
///
/// Queue a work item.
///
- /// Returns a IWorkItemResult object, but its GetResult() will always return null
+ /// 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 = SmartThreadPool.DefaultWorkItemPriority);
#endregion
@@ -346,22 +346,22 @@ public interface IWorkItemsGroup
public enum CallToPostExecute
{
///
- /// Never call to the PostExecute call back
+ /// Never call to the PostExecute call back.
///
Never = 0x00,
///
- /// Call to the PostExecute only when the work item is cancelled
+ /// Call to the PostExecute only when the work item is cancelled.
///
WhenWorkItemCanceled = 0x01,
///
- /// Call to the PostExecute only when the work item is not cancelled
+ /// Call to the PostExecute only when the work item is not cancelled.
///
WhenWorkItemNotCanceled = 0x02,
///
- /// Always call to the PostExecute
+ /// Always call to the PostExecute.
///
Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled,
}
@@ -406,15 +406,15 @@ public interface IWorkItemResult : IWaitableResult
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits.
///
- /// The result of the work item
+ /// The result of the work item.
TResult GetResult();
///
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout.
///
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
TResult GetResult(
int millisecondsTimeout,
bool exitContext);
@@ -423,8 +423,8 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout.
///
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
TResult GetResult(
TimeSpan timeout,
bool exitContext);
@@ -433,14 +433,14 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
///
- /// Timeout in milliseconds, or -1 for infinite
+ /// Timeout in milliseconds, or -1 for infinite.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the blocking if needed
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
- /// On cancel throws WorkItemCancelException
+ /// A cancel wait handle to interrupt the blocking if needed.
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
+ /// On cancel throws WorkItemCancelException.
TResult GetResult(
int millisecondsTimeout,
bool exitContext,
@@ -450,9 +450,9 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
///
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
- /// On cancel throws WorkItemCancelException
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
+ /// On cancel throws WorkItemCancelException.
TResult GetResult(
TimeSpan timeout,
bool exitContext,
@@ -462,8 +462,8 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits.
///
- /// Filled with the exception if one was thrown
- /// The result of the work item
+ /// Filled with the exception if one was thrown.
+ /// The result of the work item.
TResult GetResult(out Exception e);
///
@@ -472,9 +472,9 @@ TResult GetResult(
///
///
///
- /// Filled with the exception if one was thrown
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
+ /// Filled with the exception if one was thrown.
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
TResult GetResult(
int millisecondsTimeout,
bool exitContext,
@@ -485,10 +485,10 @@ TResult GetResult(
/// If the work item didn't run yet then the caller waits until timeout.
///
///
- /// Filled with the exception if one was thrown
+ /// Filled with the exception if one was thrown.
///
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
TResult GetResult(
TimeSpan timeout,
bool exitContext,
@@ -498,15 +498,15 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
///
- /// Timeout in milliseconds, or -1 for infinite
+ /// Timeout in milliseconds, or -1 for infinite.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the blocking if needed
- /// Filled with the exception if one was thrown
- /// The result of the work item
- /// On timeout throws WorkItemTimeoutException
- /// On cancel throws WorkItemCancelException
+ /// A cancel wait handle to interrupt the blocking if needed.
+ /// Filled with the exception if one was thrown.
+ /// The result of the work item.
+ /// On timeout throws WorkItemTimeoutException.
+ /// On cancel throws WorkItemCancelException.
TResult GetResult(
int millisecondsTimeout,
bool exitContext,
@@ -517,13 +517,13 @@ TResult GetResult(
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
///
- /// The result of the work item
+ /// The result of the work item.
///
- /// Filled with the exception if one was thrown
+ /// Filled with the exception if one was thrown.
///
///
- /// On timeout throws WorkItemTimeoutException
- /// On cancel throws WorkItemCancelException
+ /// On timeout throws WorkItemTimeoutException.
+ /// On cancel throws WorkItemCancelException.
TResult GetResult(
TimeSpan timeout,
bool exitContext,
@@ -541,7 +541,7 @@ TResult GetResult(
bool IsCanceled { get; }
///
- /// Gets the user-defined object that contains context data
+ /// Gets the user-defined object that contains context data.
/// for the work item method.
///
object State { get; }
@@ -553,30 +553,30 @@ TResult GetResult(
///
/// Cancel the work item execution.
- /// If the work item is in the queue then it won't execute
- /// If the work item is completed, it will remain completed
+ /// If the work item is in the queue then it won't execute.
+ /// If the work item is completed, it will remain completed.
/// If the work item is in progress then the user can check the SmartThreadPool.IsWorkItemCanceled
/// property to check if the work item has been cancelled. If the abortExecution is set to true then
/// the Smart Thread Pool will send an AbortException to the running thread to stop the execution
/// of the work item. When an in progress work item is canceled its GetResult will throw WorkItemCancelException.
- /// If the work item is already cancelled it will remain cancelled
+ /// If the work item is already cancelled it will remain cancelled.
///
/// When true send an AbortException to the executing thread.
/// Returns true if the work item was not completed, otherwise false.
bool Cancel(bool abortExecution);
///
- /// Get the work item's priority
+ /// Get the work item's priority.
///
WorkItemPriority WorkItemPriority { get; }
///
- /// Return the result, same as GetResult()
+ /// Return the result, same as GetResult().
///
TResult Result { get; }
///
- /// Returns the exception if occured otherwise returns null.
+ /// Returns the exception if occurred otherwise returns null.
///
object Exception { get; }
}
diff --git a/SmartThreadPool/InternalInterfaces.cs b/SmartThreadPool/InternalInterfaces.cs
index b1efa34..10907cc 100644
--- a/SmartThreadPool/InternalInterfaces.cs
+++ b/SmartThreadPool/InternalInterfaces.cs
@@ -2,7 +2,7 @@
namespace Amib.Threading.Internal
{
///
- /// An internal delegate to call when the WorkItem starts or completes
+ /// An internal delegate to call when the WorkItem starts or completes.
///
internal delegate void WorkItemStateCallback(WorkItem workItem);
diff --git a/SmartThreadPool/PriorityQueue.cs b/SmartThreadPool/PriorityQueue.cs
index 409c879..ce438b7 100644
--- a/SmartThreadPool/PriorityQueue.cs
+++ b/SmartThreadPool/PriorityQueue.cs
@@ -8,30 +8,30 @@ namespace Amib.Threading.Internal
#region PriorityQueue class
///
- /// PriorityQueue class
- /// This class is not thread safe because we use external lock
+ /// 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
+ /// 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
+ /// Work items queues. There is one for each type of priority.
///
private readonly LinkedList[] _queues = new LinkedList[_queuesCount];
///
- /// The total number of work items within the queues
+ /// The total number of work items within the queues.
///
private int _workItemsCount;
///
- /// Use with IEnumerable interface
+ /// Use with IEnumerable interface.
///
private int _version;
@@ -39,6 +39,10 @@ public sealed class PriorityQueue : IEnumerable
#region Contructor
+ ///
+ /// Empty constructor.
+ /// Initializes each queue with an empty list.
+ ///
public PriorityQueue()
{
for(int i = 0; i < _queues.Length; ++i)
@@ -69,9 +73,9 @@ public void Enqueue(IHasWorkItemPriority workItem)
}
///
- /// Dequeque a work item.
+ /// Dequeue a work item.
///
- /// Returns the next work item
+ /// Returns the next work item.
public IHasWorkItemPriority Dequeue()
{
IHasWorkItemPriority workItem = null;
@@ -91,11 +95,11 @@ public IHasWorkItemPriority Dequeue()
}
///
- /// Find the next non empty queue starting at queue queueIndex+1
+ /// Find the next non empty queue starting at queue queueIndex+1.
///
- /// The index-1 to start from
+ /// The index-1 to start from.
///
- /// The index of the next non empty queue or -1 if all the queues are empty
+ /// The index of the next non empty queue or -1 if all the queues are empty.
///
private int GetNextNonEmptyQueue(int queueIndex)
{
@@ -110,7 +114,7 @@ private int GetNextNonEmptyQueue(int queueIndex)
}
///
- /// The number of work items
+ /// The number of work items.
///
public int Count
{
@@ -121,7 +125,7 @@ public int Count
}
///
- /// Clear all the work items
+ /// Clear all the work items.
///
public void Clear()
{
@@ -141,9 +145,9 @@ public void Clear()
#region IEnumerable Members
///
- /// Returns an enumerator to iterate over the work items
+ /// Returns an enumerator to iterate over the work items.
///
- /// Returns an enumerator
+ /// Returns an enumerator.
public IEnumerator GetEnumerator()
{
return new PriorityQueueEnumerator(this);
@@ -154,7 +158,7 @@ public IEnumerator GetEnumerator()
#region PriorityQueueEnumerator
///
- /// The class the implements the enumerator
+ /// The class the implements the enumerator.
///
private class PriorityQueueEnumerator : IEnumerator
{
diff --git a/SmartThreadPool/SmartThreadPool.cs b/SmartThreadPool/SmartThreadPool.cs
index dc067a5..bd07359 100644
--- a/SmartThreadPool/SmartThreadPool.cs
+++ b/SmartThreadPool/SmartThreadPool.cs
@@ -256,19 +256,19 @@ public partial class SmartThreadPool : WorkItemsGroupBase, IDisposable
///
/// Stores a copy of the original STPStartInfo.
- /// It is used to change the MinThread and MaxThreads
+ /// It is used to change the MinThread and MaxThreads.
///
private STPStartInfo _stpStartInfo;
///
- /// Total number of work items that are stored in the work items queue
+ /// Total number of work items that are stored in the work items queue.
/// plus the work items that the threads in the pool are working on.
///
private volatile int _currentWorkItemsCount;
///
/// Signaled when the thread pool is idle, i.e. no thread is busy
- /// and the work items queue is empty
+ /// and the work items queue is empty.
///
//private ManualResetEvent _isIdleWaitHandle = new ManualResetEvent(true);
private ManualResetEvent _isIdleWaitHandle = EventWaitHandleFactory.CreateManualResetEvent(true);
@@ -296,30 +296,30 @@ public partial class SmartThreadPool : WorkItemsGroupBase, IDisposable
private int _threadCounter;
///
- /// Indicate that the SmartThreadPool has been disposed
+ /// Indicate that the SmartThreadPool has been disposed.
///
private bool _isDisposed;
///
- /// Holds all the WorkItemsGroup instaces that have at least one
- /// work item int the SmartThreadPool
- /// This variable is used in case of Shutdown
+ /// Holds all the WorkItemsGroup instances that have at least one
+ /// work item int the SmartThreadPool.
+ /// This variable is used in case of Shutdown.
///
private readonly SynchronizedDictionary _workItemsGroups = new SynchronizedDictionary();
///
/// A common object for all the work items int the STP
- /// so we can mark them to cancel in O(1)
+ /// so we can mark them to cancel in O(1).
///
private CanceledWorkItemsGroup _canceledSmartThreadPool = new CanceledWorkItemsGroup();
///
- /// Windows STP performance counters
+ /// Windows STP performance counters.
///
private ISTPInstancePerformanceCounters _windowsPCs = NullSTPInstancePerformanceCounters.Instance;
///
- /// Local STP performance counters
+ /// Local STP performance counters.
///
private ISTPInstancePerformanceCounters _localPCs = NullSTPInstancePerformanceCounters.Instance;
@@ -328,7 +328,7 @@ public partial class SmartThreadPool : WorkItemsGroupBase, IDisposable
///
/// An event to call after a thread is created, but before
- /// it's first use.
+ /// its first use.
///
private event ThreadInitializationHandler _onThreadInitialization;
@@ -374,7 +374,7 @@ public SmartThreadPool()
///
/// Constructor
///
- /// Idle timeout in milliseconds
+ /// Idle timeout in milliseconds.
public SmartThreadPool(int idleTimeout)
{
_stpStartInfo = new STPStartInfo
@@ -400,8 +400,8 @@ public SmartThreadPool(bool startSuspended)
///
/// Constructor
///
- /// Idle timeout in milliseconds
- /// Upper limit of threads in the pool
+ /// Idle timeout in milliseconds.
+ /// Upper limit of threads in the pool.
public SmartThreadPool(
int idleTimeout,
int maxWorkerThreads)
@@ -417,9 +417,9 @@ public SmartThreadPool(
///
/// Constructor
///
- /// Idle timeout in milliseconds
- /// Upper limit of threads in the pool
- /// Lower limit of threads in the pool
+ /// Idle timeout in milliseconds.
+ /// Upper limit of threads in the pool.
+ /// Lower limit of threads in the pool.
public SmartThreadPool(
int idleTimeout,
int maxWorkerThreads,
@@ -437,7 +437,7 @@ public SmartThreadPool(
///
/// Constructor
///
- /// A SmartThreadPool configuration that overrides the default behavior
+ /// A SmartThreadPool configuration that overrides the default behavior.
public SmartThreadPool(STPStartInfo stpStartInfo)
{
_stpStartInfo = new STPStartInfo(stpStartInfo);
@@ -553,9 +553,9 @@ private WorkItem Dequeue()
}
///
- /// Put a new work item in the queue
+ /// Put a new work item in the queue.
///
- /// A work item to queue
+ /// A work item to queue.
internal override void Enqueue(WorkItem workItem)
{
// Make sure the workItem is not null
@@ -623,7 +623,7 @@ internal void UnregisterWorkItemsGroup(IWorkItemsGroup workItemsGroup)
}
///
- /// Inform that the current thread is about to quit or quiting.
+ /// Inform that the current thread is about to quit or quitting.
/// The same thread may call this method more than once.
///
private void InformCompleted()
@@ -640,9 +640,9 @@ private void InformCompleted()
}
///
- /// Starts new threads
+ /// Starts new threads.
///
- /// The number of threads to start
+ /// The number of threads to start.
private void StartThreads(int threadsCount)
{
if (_isSuspended)
@@ -920,8 +920,8 @@ private static void ValidateWorkItemsGroupWaitForIdleImpl(IWorkItemsGroup workIt
}
///
- /// Force the SmartThreadPool to shutdown
- /// Doesn't use Thread.Abort
+ /// Force the SmartThreadPool to shutdown.
+ /// Doesn't use Thread.Abort.
///
public void Shutdown()
{
@@ -931,8 +931,8 @@ public void Shutdown()
// Thread.Abort is not supported in .net core
///
- /// Force the SmartThreadPool to shutdown with timeout
- /// Doesn't use Thread.Abort
+ /// Force the SmartThreadPool to shutdown with timeout.
+ /// Doesn't use Thread.Abort.
///
public void Shutdown(TimeSpan timeout)
{
@@ -941,7 +941,7 @@ public void Shutdown(TimeSpan timeout)
///
/// Empties the queue of work items and abort the threads in the pool.
- /// Doesn't use Thread.Abort
+ /// Doesn't use Thread.Abort.
///
public void Shutdown(int millisecondsTimeout)
{
@@ -1064,9 +1064,9 @@ private void ShutdownImpl(bool forceAbort, int millisecondsTimeout)
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
///
/// true when every work item in workItemResults has completed; otherwise false.
///
@@ -1077,10 +1077,10 @@ public static bool WaitAll(
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
- /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
+ /// Array of work item result objects.
+ /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
@@ -1096,14 +1096,14 @@ public static bool WaitAll(
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
- /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
+ /// Array of work item result objects.
+ /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// true when every work item in workItemResults has completed; otherwise false.
///
@@ -1117,9 +1117,9 @@ public static bool WaitAll(
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
@@ -1136,14 +1136,14 @@ public static bool WaitAll(
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// true when every work item in workItemResults has completed; otherwise false.
///
@@ -1158,9 +1158,9 @@ public static bool WaitAll(
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if any of the work items has been canceled.
///
@@ -1171,10 +1171,10 @@ public static int WaitAny(
}
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
- /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
+ /// Array of work item result objects.
+ /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
@@ -1190,14 +1190,14 @@ public static int WaitAny(
}
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
- /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
+ /// Array of work item result objects.
+ /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
@@ -1211,9 +1211,9 @@ public static int WaitAny(
}
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
@@ -1230,14 +1230,14 @@ public static int WaitAny(
}
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
@@ -1253,7 +1253,7 @@ public static int WaitAny(
///
/// Creates a new WorkItemsGroup.
///
- /// The number of work items that can be run concurrently
+ /// The number of work items that can be run concurrently.
/// A reference to the WorkItemsGroup
public IWorkItemsGroup CreateWorkItemsGroup(int concurrency)
{
@@ -1264,8 +1264,8 @@ public IWorkItemsGroup CreateWorkItemsGroup(int concurrency)
///
/// Creates a new WorkItemsGroup.
///
- /// The number of work items that can be run concurrently
- /// A WorkItemsGroup configuration that overrides the default behavior
+ /// The number of work items that can be run concurrently.
+ /// A WorkItemsGroup configuration that overrides the default behavior.
/// A reference to the WorkItemsGroup
public IWorkItemsGroup CreateWorkItemsGroup(int concurrency, WIGStartInfo wigStartInfo)
{
@@ -1491,7 +1491,7 @@ public static void AbortOnWorkItemCancel()
}
///
- /// Thread Pool start information (readonly)
+ /// Thread Pool start information. (readonly)
///
public STPStartInfo STPStartInfo
{
@@ -1507,7 +1507,7 @@ public bool IsShuttingdown
}
///
- /// Return the local calculated performance counters
+ /// Return the local calculated performance counters.
/// Available only if STPStartInfo.EnableLocalPerformanceCounters is true.
///
public ISTPPerformanceCountersReader PerformanceCountersReader
@@ -1557,7 +1557,7 @@ private void ValidateNotDisposed()
#region WorkItemsGroupBase Overrides
///
- /// Get/Set the maximum number of work items that execute cocurrency on the thread pool
+ /// Get/Set the maximum number of work items that execute concurrency on the thread pool.
///
public override int Concurrency
{
@@ -1659,7 +1659,7 @@ public override void Cancel(bool abortExecution)
}
///
- /// Wait for the thread pool to be idle
+ /// Wait for the thread pool to be idle.
///
public override bool WaitForIdle(int millisecondsTimeout)
{
@@ -1703,7 +1703,7 @@ internal override void PreQueueWorkItem()
/// Executes all actions in parallel.
/// Returns when they all finish.
///
- /// Actions to execute
+ /// Actions to execute.
public void Join(IEnumerable actions)
{
WIGStartInfo wigStartInfo = new WIGStartInfo { StartSuspended = true };
@@ -1720,7 +1720,7 @@ public void Join(IEnumerable actions)
/// Executes all actions in parallel.
/// Returns when they all finish.
///
- /// Actions to execute
+ /// Actions to execute.
public void Join(params Action[] actions)
{
Join((IEnumerable)actions);
@@ -1732,10 +1732,10 @@ private class ChoiceIndex
}
///
- /// Executes all actions in parallel
- /// Returns when the first one completes
+ /// Executes all actions in parallel.
+ /// Returns when the first one completes.
///
- /// Actions to execute
+ /// Actions to execute.
public int Choice(IEnumerable actions)
{
WIGStartInfo wigStartInfo = new WIGStartInfo { StartSuspended = true };
@@ -1760,10 +1760,10 @@ public int Choice(IEnumerable actions)
}
///
- /// Executes all actions in parallel
- /// Returns when the first one completes
+ /// Executes all actions in parallel.
+ /// Returns when the first one completes.
///
- /// Actions to execute
+ /// Actions to execute.
public int Choice(params Action[] actions)
{
return Choice((IEnumerable)actions);
@@ -1773,8 +1773,8 @@ public int Choice(params Action[] actions)
/// Executes actions in sequence asynchronously.
/// Returns immediately.
///
- /// A state context that passes
- /// Actions to execute in the order they should run
+ /// A state context that passes.
+ /// Actions to execute in the order they should run.
public void Pipe(T pipeState, IEnumerable> actions)
{
WIGStartInfo wigStartInfo = new WIGStartInfo { StartSuspended = true };
@@ -1793,7 +1793,7 @@ public void Pipe(T pipeState, IEnumerable> actions)
/// Returns immediately.
///
///
- /// Actions to execute in the order they should run
+ /// Actions to execute in the order they should run.
public void Pipe(T pipeState, params Action[] actions)
{
Pipe(pipeState, (IEnumerable>)actions);
diff --git a/SmartThreadPool/SmartThreadPool.csproj b/SmartThreadPool/SmartThreadPool.csproj
index 436b16f..f27e813 100644
--- a/SmartThreadPool/SmartThreadPool.csproj
+++ b/SmartThreadPool/SmartThreadPool.csproj
@@ -20,6 +20,7 @@
SmartThreadPool.dll
2.3.0.0
2.3.0.0
+ True
diff --git a/SmartThreadPool/Stopwatch.cs b/SmartThreadPool/Stopwatch.cs
index c6f88d9..3d8c536 100644
--- a/SmartThreadPool/Stopwatch.cs
+++ b/SmartThreadPool/Stopwatch.cs
@@ -4,7 +4,7 @@ namespace Amib.Threading.Internal
{
///
/// Stopwatch class
- /// Used with WindowsCE and Silverlight which don't have Stopwatch
+ /// Used with WindowsCE and Silverlight which don't have Stopwatch.
///
internal class Stopwatch
{
diff --git a/SmartThreadPool/WIGStartInfo.cs b/SmartThreadPool/WIGStartInfo.cs
index 8af195b..aee7d5b 100644
--- a/SmartThreadPool/WIGStartInfo.cs
+++ b/SmartThreadPool/WIGStartInfo.cs
@@ -51,7 +51,7 @@ protected void ThrowIfReadOnly()
}
///
- /// Get/Set if to use the caller's security context
+ /// Get/Set if to use the caller's security context.
///
public virtual bool UseCallerCallContext
{
@@ -65,7 +65,7 @@ public virtual bool UseCallerCallContext
///
- /// Get/Set if to use the caller's HTTP context
+ /// Get/Set if to use the caller's HTTP context.
///
public virtual bool UseCallerHttpContext
{
@@ -79,7 +79,7 @@ public virtual bool UseCallerHttpContext
///
- /// Get/Set if to dispose of the state object of a work item
+ /// Get/Set if to dispose of the state object of a work item.
///
public virtual bool DisposeOfStateObjects
{
@@ -93,7 +93,7 @@ public virtual bool DisposeOfStateObjects
///
- /// Get/Set the run the post execute options
+ /// Get/Set the run the post execute options.
///
public virtual CallToPostExecute CallToPostExecute
{
@@ -107,7 +107,7 @@ public virtual CallToPostExecute CallToPostExecute
///
- /// Get/Set the default post execute callback
+ /// Get/Set the default post execute callback.
///
public virtual PostExecuteWorkItemCallback PostExecuteWorkItemCallback
{
@@ -136,7 +136,7 @@ public virtual bool StartSuspended
///
- /// Get/Set the default priority that a work item gets when it is enqueued
+ /// Get/Set the default priority that a work item gets when it is enqueued.
///
public virtual WorkItemPriority WorkItemPriority
{
@@ -160,9 +160,9 @@ public virtual bool FillStateWithArgs
}
///
- /// Get a readonly version of this WIGStartInfo
+ /// Get a readonly version of this WIGStartInfo.
///
- /// Returns a readonly reference to this WIGStartInfoRO
+ /// Returns a readonly reference to this WIGStartInfoRO.
public WIGStartInfo AsReadOnly()
{
return new WIGStartInfo(this) { _readOnly = true };
diff --git a/SmartThreadPool/WorkItem.WorkItemResult.cs b/SmartThreadPool/WorkItem.WorkItemResult.cs
index f965c92..30c6e76 100644
--- a/SmartThreadPool/WorkItem.WorkItemResult.cs
+++ b/SmartThreadPool/WorkItem.WorkItemResult.cs
@@ -12,7 +12,7 @@ public partial class WorkItem
private class WorkItemResult : IWorkItemResult, IInternalWorkItemResult, IInternalWaitableResult
{
///
- /// A back reference to the work item
+ /// A back reference to the work item.
///
private readonly WorkItem _workItem;
@@ -121,7 +121,7 @@ public WorkItemPriority WorkItemPriority
}
///
- /// Return the result, same as GetResult()
+ /// Return the result, same as GetResult().
///
public object Result
{
@@ -129,7 +129,7 @@ public object Result
}
///
- /// Returns the exception if occured otherwise returns null.
+ /// Returns the exception if occurred otherwise returns null.
/// This value is valid only after the work item completed,
/// before that it is always null.
///
diff --git a/SmartThreadPool/WorkItem.cs b/SmartThreadPool/WorkItem.cs
index 5cff866..58e1611 100644
--- a/SmartThreadPool/WorkItem.cs
+++ b/SmartThreadPool/WorkItem.cs
@@ -70,60 +70,60 @@ private static bool IsValidStatesTransition(WorkItemState currentState, WorkItem
private readonly CallerThreadContext _callerContext;
#endif
///
- /// Holds the result of the mehtod
+ /// Holds the result of the method.
///
private object _result;
///
- /// Hold the exception if the method threw it
+ /// Hold the exception if the method threw it.
///
private Exception _exception;
///
- /// Hold the state of the work item
+ /// Hold the state of the work item.
///
private WorkItemState _workItemState;
///
- /// A ManualResetEvent to indicate that the result is ready
+ /// A ManualResetEvent to indicate that the result is ready.
///
private ManualResetEvent _workItemCompleted;
///
/// A reference count to the _workItemCompleted.
- /// When it reaches to zero _workItemCompleted is Closed
+ /// When it reaches to zero _workItemCompleted is Closed.
///
private int _workItemCompletedRefCount;
///
- /// Represents the result state of the work item
+ /// Represents the result state of the work item.
///
private readonly WorkItemResult _workItemResult;
///
- /// Work item info
+ /// Work item info.
///
private readonly WorkItemInfo _workItemInfo;
///
- /// Called when the WorkItem starts
+ /// Called when the WorkItem starts.
///
private event WorkItemStateCallback _workItemStartedEvent;
///
- /// Called when the WorkItem completes
+ /// Called when the WorkItem completes.
///
private event WorkItemStateCallback _workItemCompletedEvent;
///
/// A reference to an object that indicates whatever the
- /// WorkItemsGroup has been canceled
+ /// WorkItemsGroup has been canceled.
///
private CanceledWorkItemsGroup _canceledWorkItemsGroup = CanceledWorkItemsGroup.NotCanceledWorkItemsGroup;
///
/// A reference to an object that indicates whatever the
- /// SmartThreadPool has been canceled
+ /// SmartThreadPool has been canceled.
///
private CanceledWorkItemsGroup _canceledSmartThreadPool = CanceledWorkItemsGroup.NotCanceledWorkItemsGroup;
@@ -133,13 +133,13 @@ private static bool IsValidStatesTransition(WorkItemState currentState, WorkItem
private readonly IWorkItemsGroup _workItemsGroup;
///
- /// The thread that executes this workitem.
+ /// The thread that executes this work item.
/// This field is available for the period when the work item is executed, before and after it is null.
///
private Thread _executingThread;
///
- /// The absulote time when the work item will be timeout
+ /// The absolute time when the work item will be timeout.
///
private long _expirationTime;
@@ -149,12 +149,12 @@ private static bool IsValidStatesTransition(WorkItemState currentState, WorkItem
///
- /// Stores how long the work item waited on the stp queue
+ /// Stores how long the work item waited on the stp queue.
///
private Stopwatch _waitingOnQueueStopwatch;
///
- /// Stores how much time it took the work item to execute after it went out of the queue
+ /// Stores how much time it took the work item to execute after it went out of the queue.
///
private Stopwatch _processingStopwatch;
@@ -195,13 +195,13 @@ internal WorkItemInfo WorkItemInfo
///
/// Initialize the callback holding object.
///
- /// The workItemGroup of the workitem
- /// The WorkItemInfo of te workitem
+ /// The workItemGroup of the work item.
+ /// The WorkItemInfo of te work item.
/// Callback delegate for the callback.
/// State with which to call the callback delegate.
///
/// We assume that the WorkItem object is created within the thread
- /// that meant to run the callback
+ /// that meant to run the callback.
public WorkItem(
IWorkItemsGroup workItemsGroup,
WorkItemInfo workItemInfo,
@@ -227,7 +227,7 @@ public WorkItem(
internal void Initialize()
{
// The _workItemState is changed directly instead of using the SetWorkItemState
- // method since we don't want to go throught IsValidStateTransition.
+ // method since we don't want to go through IsValidStateTransition.
_workItemState = WorkItemState.InQueue;
_workItemCompleted = null;
@@ -300,7 +300,7 @@ public bool StartingWorkItem()
}
///
- /// Execute the work item and the post execute
+ /// Execute the work item and the post execute.
///
public void Execute()
{
@@ -357,7 +357,7 @@ internal void FireWorkItemStarted()
}
///
- /// Execute the work item
+ /// Execute the work item.
///
private void ExecuteWorkItem()
{
@@ -426,7 +426,7 @@ private void ExecuteWorkItem()
}
///
- /// Runs the post execute callback
+ /// Runs the post execute callback.
///
private void PostExecute()
{
@@ -444,10 +444,10 @@ private void PostExecute()
}
///
- /// Set the result of the work item to return
+ /// Set the result of the work item to return.
///
- /// The result of the work item
- /// The exception that was throw while the workitem executed, null
+ /// The result of the work item.
+ /// The exception that was throw while the work item executed, null
/// if there was no exception.
internal void SetResult(object result, Exception exception)
{
@@ -457,23 +457,23 @@ internal void SetResult(object result, Exception exception)
}
///
- /// Returns the work item result
+ /// Returns the work item result.
///
- /// The work item result
+ /// The work item result.
internal IWorkItemResult GetWorkItemResult()
{
return _workItemResult;
}
///
- /// Wait for all work items to complete
+ /// Wait for all work items to complete.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// true when every work item in waitableResults has completed; otherwise false.
///
@@ -548,14 +548,14 @@ internal static bool WaitAll(
}
///
- /// Waits for any of the work items in the specified array to complete, cancel, or timeout
+ /// Waits for any of the work items in the specified array to complete, cancel, or timeout.
///
- /// Array of work item result objects
+ /// Array of work item result objects.
/// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
///
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
///
- /// A cancel wait handle to interrupt the wait if needed
+ /// A cancel wait handle to interrupt the wait if needed.
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
@@ -598,8 +598,8 @@ internal static int WaitAny(
///
/// Fill an array of wait handles with the work items wait handles.
///
- /// An array of work item results
- /// An array of wait handles to fill
+ /// An array of work item results.
+ /// An array of wait handles to fill.
private static void GetWaitHandles(
IWaitableResult[] waitableResults,
WaitHandle[] waitHandles)
@@ -614,9 +614,9 @@ private static void GetWaitHandles(
}
///
- /// Release the work items' wait handles
+ /// Release the work items' wait handles.
///
- /// An array of work item results
+ /// An array of work item results.
private static void ReleaseWaitHandles(IWaitableResult[] waitableResults)
{
for (int i = 0; i < waitableResults.Length; ++i)
@@ -663,9 +663,9 @@ private WorkItemState GetWorkItemState()
///
- /// Sets the work item's state
+ /// Sets the work item's state.
///
- /// The state to set the work item to
+ /// The state to set the work item to.
private void SetWorkItemState(WorkItemState workItemState)
{
lock (this)
@@ -678,9 +678,9 @@ private void SetWorkItemState(WorkItemState workItemState)
}
///
- /// Signals that work item has been completed or canceled
+ /// Signals that work item has been completed or canceled.
///
- /// Indicates that the work item has been canceled
+ /// Indicates that the work item has been canceled.
private void SignalComplete(bool canceled)
{
SetWorkItemState(canceled ? WorkItemState.Canceled : WorkItemState.Completed);
@@ -706,7 +706,7 @@ internal void WorkItemIsQueued()
///
/// Cancel the work item if it didn't start running yet.
///
- /// Returns true on success or false if the work item is in progress or already completed
+ /// Returns true on success or false if the work item is in progress or already completed.
private bool Cancel(bool abortExecution)
{
bool success = false;
@@ -772,9 +772,9 @@ private bool Cancel(bool abortExecution)
///
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits for the result, timeout, or cancel.
- /// In case of error the method throws and exception
+ /// In case of error the method throws and exception.
///
- /// The result of the work item
+ /// The result of the work item.
private object GetResult(
int millisecondsTimeout,
bool exitContext,
@@ -792,9 +792,9 @@ private object GetResult(
///
/// Get the result of the work item.
/// If the work item didn't run yet then the caller waits for the result, timeout, or cancel.
- /// In case of error the e argument is filled with the exception
+ /// In case of error the e argument is filled with the exception.
///
- /// The result of the work item
+ /// The result of the work item.
private object GetResult(
int millisecondsTimeout,
bool exitContext,
@@ -868,7 +868,7 @@ private object GetResult(
}
///
- /// A wait handle to wait for completion, cancel, or timeout
+ /// A wait handle to wait for completion, cancel, or timeout.
///
private WaitHandle GetWaitHandle()
{
@@ -900,7 +900,7 @@ private void ReleaseWaitHandle()
}
///
- /// Returns true when the work item has completed or canceled
+ /// Returns true when the work item has completed or canceled.
///
private bool IsCompleted
{
@@ -916,7 +916,7 @@ private bool IsCompleted
}
///
- /// Returns true when the work item has canceled
+ /// Returns true when the work item has canceled.
///
public bool IsCanceled
{
@@ -934,7 +934,7 @@ public bool IsCanceled
#region IHasWorkItemPriority Members
///
- /// Returns the priority of the work item
+ /// Returns the priority of the work item.
///
public WorkItemPriority WorkItemPriority
{
diff --git a/SmartThreadPool/WorkItemFactory.cs b/SmartThreadPool/WorkItemFactory.cs
index 16ccd81..db8f481 100644
--- a/SmartThreadPool/WorkItemFactory.cs
+++ b/SmartThreadPool/WorkItemFactory.cs
@@ -7,10 +7,10 @@ namespace Amib.Threading.Internal
public class WorkItemFactory
{
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The WorkItemsGroup of this workitem
- /// Work item group start information
+ /// The WorkItemsGroup of this work item.
+ /// Work item group start information.
/// A callback to execute
/// Returns a work item
public static WorkItem CreateWorkItem(
@@ -24,11 +24,11 @@ public static WorkItem CreateWorkItem(
///
/// 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
+ /// The WorkItemsGroup of this work item.
+ /// 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,
@@ -41,11 +41,11 @@ public static WorkItem CreateWorkItem(
///
/// Create a new work item
///
- /// The WorkItemsGroup of this workitem
- /// Work item group start information
- /// Work item info
- /// A callback to execute
- /// Returns a work item
+ /// The WorkItemsGroup of this work item.
+ /// Work item group start information.
+ /// Work item info.
+ /// A callback to execute.
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -63,13 +63,13 @@ public static WorkItem CreateWorkItem(
///
/// Create a new work item
///
- /// The WorkItemsGroup of this workitem
- /// Work item group start information
- /// A callback to execute
+ /// The WorkItemsGroup of this work item.
+ /// Work item group start information.
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
- /// Returns a work item
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -95,16 +95,16 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
+ /// 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
+ /// The work item priority.
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -132,16 +132,16 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// Work item information
- /// A callback to execute
+ /// The work items group.
+ /// Work item group start information.
+ /// Work item information.
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
- /// Returns a work item
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -162,18 +162,18 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Returns a work item
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -202,19 +202,19 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// The work item priority
- /// Returns a work item
+ /// The work item priority.
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -244,19 +244,19 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Indicates on which cases to call to the post execute callback
- /// Returns a work item
+ /// Indicates on which cases to call to the post execute callback.
+ /// Returns a work item.
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
@@ -286,20 +286,20 @@ public static WorkItem CreateWorkItem(
}
///
- /// Create a new work item
+ /// Create a new work item.
///
- /// The work items group
- /// Work item group start information
- /// A callback to execute
+ /// 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
+ /// 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
+ /// 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,
diff --git a/SmartThreadPool/WorkItemInfo.cs b/SmartThreadPool/WorkItemInfo.cs
index 0d7fc85..5bd8cbb 100644
--- a/SmartThreadPool/WorkItemInfo.cs
+++ b/SmartThreadPool/WorkItemInfo.cs
@@ -29,38 +29,38 @@ public WorkItemInfo(WorkItemInfo workItemInfo)
}
///
- /// Get/Set if to use the caller's security context
+ /// Get/Set if to use the caller's security context.
///
public bool UseCallerCallContext { get; set; }
///
- /// Get/Set if to use the caller's HTTP context
+ /// Get/Set if to use the caller's HTTP context.
///
public bool UseCallerHttpContext { get; set; }
///
- /// Get/Set if to dispose of the state object of a work item
+ /// Get/Set if to dispose of the state object of a work item.
///
public bool DisposeOfStateObjects { get; set; }
///
- /// Get/Set the run the post execute options
+ /// Get/Set the run the post execute options.
///
public CallToPostExecute CallToPostExecute { get; set; }
///
- /// Get/Set the post execute callback
+ /// Get/Set the post execute callback.
///
public PostExecuteWorkItemCallback PostExecuteWorkItemCallback { get; set; }
///
- /// Get/Set the work item's priority
+ /// 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!
+ /// Get/Set the work item's timeout in milliseconds.
+ /// This is a passive timeout. When the timeout expires the work item won't be actively aborted!
///
public long Timeout { get; set; }
}
diff --git a/SmartThreadPool/WorkItemsGroup.cs b/SmartThreadPool/WorkItemsGroup.cs
index 14740fd..8982dbb 100644
--- a/SmartThreadPool/WorkItemsGroup.cs
+++ b/SmartThreadPool/WorkItemsGroup.cs
@@ -153,7 +153,7 @@ public override object[] GetStates()
}
///
- /// WorkItemsGroup start information
+ /// WorkItemsGroup start information.
///
public override WIGStartInfo WIGStartInfo
{
@@ -161,7 +161,7 @@ public override WIGStartInfo WIGStartInfo
}
///
- /// Start the Work Items Group if it was started suspended
+ /// Start the Work Items Group if it was started suspended.
///
public override void Start()
{
@@ -192,7 +192,7 @@ public override void Cancel(bool abortExecution)
}
///
- /// Wait for the thread pool to be idle
+ /// Wait for the thread pool to be idle.
///
public override bool WaitForIdle(int millisecondsTimeout)
{
diff --git a/SmartThreadPool/WorkItemsGroupBase.cs b/SmartThreadPool/WorkItemsGroupBase.cs
index c6c0fdb..bd82b6c 100644
--- a/SmartThreadPool/WorkItemsGroupBase.cs
+++ b/SmartThreadPool/WorkItemsGroupBase.cs
@@ -25,7 +25,7 @@ public WorkItemsGroupBase()
#region Public Methods
///
- /// Get/Set the name of the SmartThreadPool/WorkItemsGroup instance
+ /// Get/Set the name of the SmartThreadPool/WorkItemsGroup instance.
///
public string Name
{
@@ -57,7 +57,7 @@ internal virtual void PreQueueWorkItem() { }
///
/// Cancel all the work items.
- /// Same as Cancel(false)
+ /// Same as Cancel(false).
///
public virtual void Cancel()
{
@@ -65,7 +65,7 @@ public virtual void Cancel()
}
///
- /// Wait for the SmartThreadPool/WorkItemsGroup to be idle
+ /// Wait for the SmartThreadPool/WorkItemsGroup to be idle.
///
public void WaitForIdle()
{
@@ -73,7 +73,7 @@ public void WaitForIdle()
}
///
- /// Wait for the SmartThreadPool/WorkItemsGroup to be idle
+ /// Wait for the SmartThreadPool/WorkItemsGroup to be idle.
///
public bool WaitForIdle(TimeSpan timeout)
{
@@ -90,10 +90,10 @@ public bool WaitForIdle(TimeSpan timeout)
#region QueueWorkItem
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
- /// Returns a work item result
+ /// A callback to execute.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemCallback callback)
{
WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback);
@@ -102,11 +102,11 @@ public IWorkItemResult QueueWorkItem(WorkItemCallback callback)
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
- /// The priority of the work item
- /// Returns a work item result
+ /// A callback to execute.
+ /// The priority of the work item.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority workItemPriority)
{
PreQueueWorkItem();
@@ -116,11 +116,11 @@ public IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// Work item info
- /// A callback to execute
- /// Returns a work item result
+ /// Work item info.
+ /// A callback to execute.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback)
{
PreQueueWorkItem();
@@ -130,13 +130,13 @@ public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
- /// Returns a work item result
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state)
{
WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state);
@@ -145,14 +145,14 @@ public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state)
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// The work item priority.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority)
{
PreQueueWorkItem();
@@ -162,14 +162,14 @@ public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, Wo
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// Work item information
- /// A callback to execute
+ /// Work item information.
+ /// A callback to execute.
///
/// The context object of the work item. Used for passing arguments to the work item.
///
- /// Returns a work item result
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback, object state)
{
PreQueueWorkItem();
@@ -179,16 +179,16 @@ public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Returns a work item result
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(
WorkItemCallback callback,
object state,
@@ -201,17 +201,17 @@ public IWorkItemResult QueueWorkItem(
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// The work item priority
- /// Returns a work item result
+ /// The work item priority.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(
WorkItemCallback callback,
object state,
@@ -225,17 +225,17 @@ public IWorkItemResult QueueWorkItem(
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// A delegate to call after the callback completion.
///
- /// Indicates on which cases to call to the post execute callback
- /// Returns a work item result
+ /// Indicates on which cases to call to the post execute callback.
+ /// Returns a work item result.
public IWorkItemResult QueueWorkItem(
WorkItemCallback callback,
object state,
@@ -249,18 +249,18 @@ public IWorkItemResult QueueWorkItem(
}
///
- /// Queue a work item
+ /// Queue a work item.
///
- /// A callback to execute
+ /// 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
+ /// 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
+ /// 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,
diff --git a/SmartThreadPool/WorkItemsQueue.cs b/SmartThreadPool/WorkItemsQueue.cs
index 8eaf593..ec0b7eb 100644
--- a/SmartThreadPool/WorkItemsQueue.cs
+++ b/SmartThreadPool/WorkItemsQueue.cs
@@ -19,17 +19,17 @@ public class WorkItemsQueue : IDisposable
private readonly WaiterEntry _headWaiterEntry = new WaiterEntry();
///
- /// Waiters count
+ /// Waiters count.
///
private int _waitersCount = 0;
///
- /// Work items queue
+ /// Work items queue.
///
private readonly PriorityQueue _workItems = new PriorityQueue();
///
- /// Indicate that work items are allowed to be queued
+ /// Indicate that work items are allowed to be queued.
///
private bool _isWorkItemsQueueActive = true;
@@ -61,7 +61,7 @@ private static WaiterEntry CurrentWaiterEntry
#region Public properties
///
- /// Returns the current number of work items in the queue
+ /// Returns the current number of work items in the queue.
///
public int Count
{
@@ -72,7 +72,7 @@ public int Count
}
///
- /// Returns the current number of waiters
+ /// Returns the current number of waiters.
///
public int WaitersCount
{
@@ -148,7 +148,7 @@ public WorkItem DequeueWorkItem(
{
// This method cause the caller to wait for a work item.
// If there is at least one waiting work item then the
- // method returns immidiately with it.
+ // method returns immediately with it.
//
// If there are no waiting work items then the caller
// is queued between other waiters for a work item to arrive.
@@ -190,7 +190,7 @@ public WorkItem DequeueWorkItem(
// During the wait we are supposes to exit the synchronization
// domain. (Placing true as the third argument of the WaitAny())
// It just doesn't work, I don't know why, so I have two lock(this)
- // statments instead of one.
+ // statements instead of one.
int index = STPEventWaitHandle.WaitAny(
waitHandles,
@@ -240,7 +240,7 @@ public WorkItem DequeueWorkItem(
///
/// Cleanup the work items queue, hence no more work
- /// items are allowed to be queue
+ /// items are allowed to be queued.
///
private void Cleanup()
{
@@ -299,10 +299,10 @@ public object[] GetStates()
#region Private methods
///
- /// Returns the WaiterEntry of the current thread
+ /// Returns the WaiterEntry of the current thread.
///
///
- /// In order to avoid creation and destuction of WaiterEntry
+ /// In order to avoid creation and destruction of WaiterEntry
/// objects each thread has its own WaiterEntry object.
private static WaiterEntry GetThreadWaiterEntry()
{
@@ -317,9 +317,9 @@ private static WaiterEntry GetThreadWaiterEntry()
#region Waiters stack methods
///
- /// Push a new waiter into the waiter's stack
+ /// Push a new waiter into the waiter's stack.
///
- /// A waiter to put in the stack
+ /// A waiter to put in the stack.
public void PushWaiter(WaiterEntry newWaiterEntry)
{
// Remove the waiter if it is already in the stack and
@@ -352,9 +352,9 @@ public void PushWaiter(WaiterEntry newWaiterEntry)
}
///
- /// Pop a waiter from the waiter's stack
+ /// Pop a waiter from the waiter's stack.
///
- /// Returns the first waiter in the stack
+ /// Returns the first waiter in the stack.
private WaiterEntry PopWaiter()
{
// Store the current stack head
@@ -379,10 +379,10 @@ private WaiterEntry PopWaiter()
}
///
- /// Remove a waiter from the stack
+ /// Remove a waiter from the stack.
///
- /// A waiter entry to remove
- /// If true the waiter count is always decremented
+ /// A waiter entry to remove.
+ /// If true the waiter count is always decremented.
private void RemoveWaiter(WaiterEntry waiterEntry, bool popDecrement)
{
// Store the prev entry in the list