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