mirror of
git://opensimulator.org/git/opensim
synced 2026-08-14 09:02:50 +00:00
SmartThreadPool code comes from http://www.codeproject.com/Articles/7933/Smart-Thread-Pool This version implements thread abort (via WorkItem.Cancel(true)), threadpool naming, max thread stack, etc. so we no longer need to manually patch those. However, two changes have been made to stock 2.2.3. Major change: WorkItem.Cancel(bool abortExecution) in our version does not succeed if the work item was in progress and thread abort was not specified. This is to match previous behaviour where we handle co-operative termination via another mechanism rather than checking WorkItem.IsCanceled. Minor change: Did not add STP's StopWatch implementation as this is only used WinCE and Silverlight and causes a build clash with System.Diagnostics.StopWatch The reason for updating is to see if this improves http://opensimulator.org/mantis/view.php?id=6557 and http://opensimulator.org/mantis/view.php?id=6586
112 lines
2.7 KiB
C#
112 lines
2.7 KiB
C#
using System;
|
|
#if !(_WINDOWS_CE)
|
|
using System.Runtime.Serialization;
|
|
#endif
|
|
|
|
namespace Amib.Threading
|
|
{
|
|
#region Exceptions
|
|
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
|
|
/// </summary>
|
|
public sealed partial class WorkItemCancelException : Exception
|
|
{
|
|
public WorkItemCancelException()
|
|
{
|
|
}
|
|
|
|
public WorkItemCancelException(string message)
|
|
: base(message)
|
|
{
|
|
}
|
|
|
|
public WorkItemCancelException(string message, Exception e)
|
|
: base(message, e)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
|
|
/// </summary>
|
|
public sealed partial class WorkItemTimeoutException : Exception
|
|
{
|
|
public WorkItemTimeoutException()
|
|
{
|
|
}
|
|
|
|
public WorkItemTimeoutException(string message)
|
|
: base(message)
|
|
{
|
|
}
|
|
|
|
public WorkItemTimeoutException(string message, Exception e)
|
|
: base(message, e)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
|
|
/// </summary>
|
|
public sealed partial class WorkItemResultException : Exception
|
|
{
|
|
public WorkItemResultException()
|
|
{
|
|
}
|
|
|
|
public WorkItemResultException(string message)
|
|
: base(message)
|
|
{
|
|
}
|
|
|
|
public WorkItemResultException(string message, Exception e)
|
|
: base(message, e)
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT) && !(WINDOWS_PHONE)
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
|
|
/// </summary>
|
|
[Serializable]
|
|
public sealed partial class WorkItemCancelException
|
|
{
|
|
public WorkItemCancelException(SerializationInfo si, StreamingContext sc)
|
|
: base(si, sc)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
|
|
/// </summary>
|
|
[Serializable]
|
|
public sealed partial class WorkItemTimeoutException
|
|
{
|
|
public WorkItemTimeoutException(SerializationInfo si, StreamingContext sc)
|
|
: base(si, sc)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
|
|
/// </summary>
|
|
[Serializable]
|
|
public sealed partial class WorkItemResultException
|
|
{
|
|
public WorkItemResultException(SerializationInfo si, StreamingContext sc)
|
|
: base(si, sc)
|
|
{
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|
|
#endregion
|
|
}
|