From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- ThirdParty/SmartThreadPool/Interfaces.cs | 444 +++++++++++++++---------------- 1 file changed, 222 insertions(+), 222 deletions(-) (limited to 'ThirdParty/SmartThreadPool/Interfaces.cs') diff --git a/ThirdParty/SmartThreadPool/Interfaces.cs b/ThirdParty/SmartThreadPool/Interfaces.cs index 513422f..8cc23a0 100644 --- a/ThirdParty/SmartThreadPool/Interfaces.cs +++ b/ThirdParty/SmartThreadPool/Interfaces.cs @@ -3,18 +3,18 @@ using System.Threading; namespace Amib.Threading { - #region Delegates - - /// - /// A delegate that represents the method to run as the work item - /// - /// A state object for the method to run - public delegate object WorkItemCallback(object state); - - /// - /// A delegate to call after the WorkItemCallback completed - /// - /// The work item result object + #region Delegates + + /// + /// A delegate that represents the method to run as the work item + /// + /// A state object for the method to run + public delegate object WorkItemCallback(object state); + + /// + /// A delegate to call after the WorkItemCallback completed + /// + /// The work item result object public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir); /// @@ -23,56 +23,56 @@ namespace Amib.Threading /// The work item result object public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir); - /// - /// A delegate to call when a WorkItemsGroup becomes idle - /// - /// A reference to the WorkItemsGroup that became idle - public delegate void WorkItemsGroupIdleHandler(IWorkItemsGroup workItemsGroup); + /// + /// A delegate to call when a WorkItemsGroup becomes idle + /// + /// A reference to the WorkItemsGroup that became idle + public delegate void WorkItemsGroupIdleHandler(IWorkItemsGroup workItemsGroup); /// - /// A delegate to call after a thread is created, but before + /// A delegate to call after a thread is created, but before /// it's first use. /// public delegate void ThreadInitializationHandler(); /// - /// A delegate to call when a thread is about to exit, after + /// A delegate to call when a thread is about to exit, after /// it is no longer belong to the pool. /// public delegate void ThreadTerminationHandler(); - #endregion + #endregion - #region WorkItem Priority + #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, - } + public enum WorkItemPriority + { + Lowest, + BelowNormal, + Normal, + AboveNormal, + Highest, + } - #endregion + #endregion - #region IWorkItemsGroup interface + #region IWorkItemsGroup interface - /// - /// IWorkItemsGroup interface + /// + /// IWorkItemsGroup interface /// Created by SmartThreadPool.CreateWorkItemsGroup() - /// - public interface IWorkItemsGroup - { - /// - /// Get/Set the name of the WorkItemsGroup - /// - string Name { get; set; } + /// + public interface IWorkItemsGroup + { + /// + /// 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 @@ -115,14 +115,14 @@ namespace Amib.Threading /// /// Wait for all work item to complete. /// - void WaitForIdle(); + void WaitForIdle(); /// /// Wait for all work item to complete, until timeout expired /// /// 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); + bool WaitForIdle(TimeSpan timeout); /// /// Wait for all work item to complete, until timeout expired @@ -150,7 +150,7 @@ namespace Amib.Threading /// Queue a work item /// /// A callback to execute - /// Returns a work item result + /// Returns a work item result IWorkItemResult QueueWorkItem(WorkItemCallback callback); /// @@ -166,7 +166,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// Returns a work item result IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state); @@ -176,7 +176,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// The work item priority /// Returns a work item result @@ -187,7 +187,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// /// A delegate to call after the callback completion @@ -200,7 +200,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// /// A delegate to call after the callback completion @@ -214,7 +214,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// /// A delegate to call after the callback completion @@ -228,7 +228,7 @@ namespace Amib.Threading /// /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// /// A delegate to call after the callback completion @@ -252,7 +252,7 @@ namespace Amib.Threading /// Work item information /// A callback to execute /// - /// The context object of the work item. Used for passing arguments to the work item. + /// The context object of the work item. Used for passing arguments to the work item. /// /// Returns a work item result IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback, object state); @@ -328,72 +328,72 @@ namespace Amib.Threading /// /// Queue a work item. /// - /// Returns a IWorkItemResult<TResult> object. + /// Returns a IWorkItemResult<TResult> object. /// its GetResult() returns a TResult object IWorkItemResult QueueWorkItem(Func func); /// /// Queue a work item. /// - /// Returns a IWorkItemResult<TResult> object. + /// Returns a IWorkItemResult<TResult> object. /// its GetResult() returns a TResult object IWorkItemResult QueueWorkItem(Func func, T arg); /// /// Queue a work item. /// - /// Returns a IWorkItemResult<TResult> object. + /// Returns a IWorkItemResult<TResult> object. /// its GetResult() returns a TResult object IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2); /// /// Queue a work item. /// - /// Returns a IWorkItemResult<TResult> object. + /// Returns a IWorkItemResult<TResult> object. /// its GetResult() returns a TResult object IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2, T3 arg3); /// /// Queue a work item. /// - /// Returns a IWorkItemResult<TResult> object. + /// Returns a IWorkItemResult<TResult> object. /// its GetResult() returns a TResult object IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2, T3 arg3, T4 arg4); #endregion } - #endregion + #endregion - #region CallToPostExecute enumerator + #region CallToPostExecute enumerator - [Flags] - public enum CallToPostExecute - { + [Flags] + public enum CallToPostExecute + { /// /// Never call to the PostExecute call back /// - Never = 0x00, + Never = 0x00, /// /// Call to the PostExecute only when the work item is cancelled /// - WhenWorkItemCanceled = 0x01, + WhenWorkItemCanceled = 0x01, /// /// Call to the PostExecute only when the work item is not cancelled /// - WhenWorkItemNotCanceled = 0x02, + WhenWorkItemNotCanceled = 0x02, /// /// Always call to the PostExecute /// - Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled, - } + Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled, + } - #endregion + #endregion - #region IWorkItemResult interface + #region IWorkItemResult interface /// /// The common interface of IWorkItemResult and IWorkItemResult<T> @@ -421,159 +421,159 @@ namespace Amib.Threading { } - /// + /// /// IWorkItemResult<TResult> interface. /// Created when a Func<TResult> work item is queued. - /// + /// 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 + { + /// + /// 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 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 + /// + /// 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 + TResult GetResult( + int millisecondsTimeout, + bool exitContext); + + /// + /// 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 + TResult GetResult( + TimeSpan timeout, + bool exitContext); + + /// + /// 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 + /// + /// 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 + TResult GetResult( + int millisecondsTimeout, + bool exitContext, + WaitHandle cancelWaitHandle); + + /// + /// 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 TResult GetResult( - int millisecondsTimeout, - bool exitContext); - - /// - /// 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 - TResult GetResult( - TimeSpan timeout, - bool exitContext); - - /// - /// 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 - /// - /// 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 - TResult GetResult( - int millisecondsTimeout, - bool exitContext, - WaitHandle cancelWaitHandle); - - /// - /// 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 - TResult GetResult( - TimeSpan timeout, - bool exitContext, - WaitHandle cancelWaitHandle); - - /// - /// 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 + TimeSpan timeout, + bool exitContext, + WaitHandle cancelWaitHandle); + + /// + /// 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 TResult GetResult(out Exception e); - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// - /// - /// Filled with the exception if one was thrown - /// The result of the work item - /// On timeout throws WorkItemTimeoutException + /// + /// Get the result of the work item. + /// If the work item didn't run yet then the caller waits until timeout. + /// + /// + /// + /// Filled with the exception if one was thrown + /// The result of the work item + /// On timeout throws WorkItemTimeoutException + TResult GetResult( + int millisecondsTimeout, + bool exitContext, + out Exception e); + + /// + /// Get the result of the work item. + /// If the work item didn't run yet then the caller waits until timeout. + /// + /// + /// Filled with the exception if one was thrown + /// + /// The result of the work item + /// On timeout throws WorkItemTimeoutException + TResult GetResult( + TimeSpan timeout, + bool exitContext, + out Exception e); + + /// + /// 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 + /// + /// 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 + TResult GetResult( + int millisecondsTimeout, + bool exitContext, + WaitHandle cancelWaitHandle, + out Exception e); + + /// + /// 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 + /// + /// Filled with the exception if one was thrown + /// + /// + /// On timeout throws WorkItemTimeoutException + /// On cancel throws WorkItemCancelException TResult GetResult( - int millisecondsTimeout, - bool exitContext, - out Exception e); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// - /// Filled with the exception if one was thrown - /// - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - TResult GetResult( - TimeSpan timeout, - bool exitContext, - out Exception e); - - /// - /// 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 - /// - /// 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 - TResult GetResult( - int millisecondsTimeout, - bool exitContext, - WaitHandle cancelWaitHandle, - out Exception e); - - /// - /// 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 - /// - /// Filled with the exception if one was thrown - /// - /// - /// On timeout throws WorkItemTimeoutException - /// On cancel throws WorkItemCancelException - TResult GetResult( - TimeSpan timeout, - bool exitContext, - WaitHandle cancelWaitHandle, - out Exception e); - - /// - /// Gets an indication whether the asynchronous operation has completed. - /// - bool IsCompleted { get; } - - /// - /// Gets an indication whether the asynchronous operation has been canceled. - /// - bool IsCanceled { get; } - - /// - /// Gets the user-defined object that contains context data + TimeSpan timeout, + bool exitContext, + WaitHandle cancelWaitHandle, + out Exception e); + + /// + /// Gets an indication whether the asynchronous operation has completed. + /// + bool IsCompleted { get; } + + /// + /// Gets an indication whether the asynchronous operation has been canceled. + /// + bool IsCanceled { get; } + + /// + /// Gets the user-defined object that contains context data /// for the work item method. - /// - object State { get; } + /// + object State { get; } - /// + /// /// Same as Cancel(false). - /// + /// bool Cancel(); /// @@ -582,7 +582,7 @@ namespace Amib.Threading /// 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 + /// 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 /// @@ -590,23 +590,23 @@ 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; } + /// + /// 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. - /// - object Exception { get; } - } + /// + /// Returns the exception if occured otherwise returns null. + /// + object Exception { get; } + } - #endregion + #endregion #region .NET 3.5 -- cgit v1.1