aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/WorkItemInfo.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-05-01 19:01:43 +0100
committerJustin Clark-Casey (justincc)2013-05-01 19:01:43 +0100
commit206fb306a7820cf593570e35ddfa8e7c5a10e449 (patch)
tree0ef0fdf42ddc0b63224af52b62b0bad42f62e352 /ThirdParty/SmartThreadPool/WorkItemInfo.cs
parentFix CAPS to work like they should - do not send caps to the viewer if they're... (diff)
downloadopensim-SC_OLD-206fb306a7820cf593570e35ddfa8e7c5a10e449.zip
opensim-SC_OLD-206fb306a7820cf593570e35ddfa8e7c5a10e449.tar.gz
opensim-SC_OLD-206fb306a7820cf593570e35ddfa8e7c5a10e449.tar.bz2
opensim-SC_OLD-206fb306a7820cf593570e35ddfa8e7c5a10e449.tar.xz
Update SmartThreadPool to latest version 2.2.3 with a major and minor change.
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
Diffstat (limited to 'ThirdParty/SmartThreadPool/WorkItemInfo.cs')
-rw-r--r--ThirdParty/SmartThreadPool/WorkItemInfo.cs171
1 files changed, 69 insertions, 102 deletions
diff --git a/ThirdParty/SmartThreadPool/WorkItemInfo.cs b/ThirdParty/SmartThreadPool/WorkItemInfo.cs
index c259339..5fbceb8 100644
--- a/ThirdParty/SmartThreadPool/WorkItemInfo.cs
+++ b/ThirdParty/SmartThreadPool/WorkItemInfo.cs
@@ -1,102 +1,69 @@
1// Ami Bar 1namespace Amib.Threading
2// amibar@gmail.com 2{
3 3 #region WorkItemInfo class
4namespace Amib.Threading 4
5{ 5 /// <summary>
6 #region WorkItemInfo class 6 /// Summary description for WorkItemInfo.
7 7 /// </summary>
8 /// <summary> 8 public class WorkItemInfo
9 /// Summary description for WorkItemInfo. 9 {
10 /// </summary> 10 public WorkItemInfo()
11 public class WorkItemInfo 11 {
12 { 12 UseCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext;
13 /// <summary> 13 UseCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext;
14 /// Use the caller's security context 14 DisposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
15 /// </summary> 15 CallToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
16 private bool _useCallerCallContext; 16 PostExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
17 17 WorkItemPriority = SmartThreadPool.DefaultWorkItemPriority;
18 /// <summary> 18 }
19 /// Use the caller's security context 19
20 /// </summary> 20 public WorkItemInfo(WorkItemInfo workItemInfo)
21 private bool _useCallerHttpContext; 21 {
22 22 UseCallerCallContext = workItemInfo.UseCallerCallContext;
23 /// <summary> 23 UseCallerHttpContext = workItemInfo.UseCallerHttpContext;
24 /// Dispose of the state object of a work item 24 DisposeOfStateObjects = workItemInfo.DisposeOfStateObjects;
25 /// </summary> 25 CallToPostExecute = workItemInfo.CallToPostExecute;
26 private bool _disposeOfStateObjects; 26 PostExecuteWorkItemCallback = workItemInfo.PostExecuteWorkItemCallback;
27 27 WorkItemPriority = workItemInfo.WorkItemPriority;
28 /// <summary> 28 Timeout = workItemInfo.Timeout;
29 /// The option to run the post execute 29 }
30 /// </summary> 30
31 private CallToPostExecute _callToPostExecute; 31 /// <summary>
32 32 /// Get/Set if to use the caller's security context
33 /// <summary> 33 /// </summary>
34 /// A post execute callback to call when none is provided in 34 public bool UseCallerCallContext { get; set; }
35 /// the QueueWorkItem method. 35
36 /// </summary> 36 /// <summary>
37 private PostExecuteWorkItemCallback _postExecuteWorkItemCallback; 37 /// Get/Set if to use the caller's HTTP context
38 38 /// </summary>
39 /// <summary> 39 public bool UseCallerHttpContext { get; set; }
40 /// The priority of the work item 40
41 /// </summary> 41 /// <summary>
42 private WorkItemPriority _workItemPriority; 42 /// Get/Set if to dispose of the state object of a work item
43 43 /// </summary>
44 public WorkItemInfo() 44 public bool DisposeOfStateObjects { get; set; }
45 { 45
46 _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; 46 /// <summary>
47 _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext; 47 /// Get/Set the run the post execute options
48 _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects; 48 /// </summary>
49 _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute; 49 public CallToPostExecute CallToPostExecute { get; set; }
50 _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback; 50
51 _workItemPriority = SmartThreadPool.DefaultWorkItemPriority; 51 /// <summary>
52 } 52 /// Get/Set the post execute callback
53 53 /// </summary>
54 public WorkItemInfo(WorkItemInfo workItemInfo) 54 public PostExecuteWorkItemCallback PostExecuteWorkItemCallback { get; set; }
55 { 55
56 _useCallerCallContext = workItemInfo._useCallerCallContext; 56 /// <summary>
57 _useCallerHttpContext = workItemInfo._useCallerHttpContext; 57 /// Get/Set the work item's priority
58 _disposeOfStateObjects = workItemInfo._disposeOfStateObjects; 58 /// </summary>
59 _callToPostExecute = workItemInfo._callToPostExecute; 59 public WorkItemPriority WorkItemPriority { get; set; }
60 _postExecuteWorkItemCallback = workItemInfo._postExecuteWorkItemCallback; 60
61 _workItemPriority = workItemInfo._workItemPriority; 61 /// <summary>
62 } 62 /// Get/Set the work item's timout in milliseconds.
63 63 /// This is a passive timout. When the timout expires the work item won't be actively aborted!
64 public bool UseCallerCallContext 64 /// </summary>
65 { 65 public long Timeout { get; set; }
66 get { return _useCallerCallContext; } 66 }
67 set { _useCallerCallContext = value; } 67
68 } 68 #endregion
69 69}
70 public bool UseCallerHttpContext
71 {
72 get { return _useCallerHttpContext; }
73 set { _useCallerHttpContext = value; }
74 }
75
76 public bool DisposeOfStateObjects
77 {
78 get { return _disposeOfStateObjects; }
79 set { _disposeOfStateObjects = value; }
80 }
81
82 public CallToPostExecute CallToPostExecute
83 {
84 get { return _callToPostExecute; }
85 set { _callToPostExecute = value; }
86 }
87
88 public PostExecuteWorkItemCallback PostExecuteWorkItemCallback
89 {
90 get { return _postExecuteWorkItemCallback; }
91 set { _postExecuteWorkItemCallback = value; }
92 }
93
94 public WorkItemPriority WorkItemPriority
95 {
96 get { return _workItemPriority; }
97 set { _workItemPriority = value; }
98 }
99 }
100
101 #endregion
102}