aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/WorkItemInfo.cs
blob: 5be82a2f04a8c79cbb1ce604a69041f65f8b8055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
namespace Amib.Threading
{
    #region WorkItemInfo class

    /// <summary>
    /// Summary description for WorkItemInfo.
    /// </summary>
    public class WorkItemInfo
    {
        public WorkItemInfo()
        {
            UseCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext;
            UseCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext;
            DisposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
            CallToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
            PostExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
            WorkItemPriority = SmartThreadPool.DefaultWorkItemPriority;
        }

        public WorkItemInfo(WorkItemInfo workItemInfo)
        {
            UseCallerCallContext = workItemInfo.UseCallerCallContext;
            UseCallerHttpContext = workItemInfo.UseCallerHttpContext;
            DisposeOfStateObjects = workItemInfo.DisposeOfStateObjects;
            CallToPostExecute = workItemInfo.CallToPostExecute;
            PostExecuteWorkItemCallback = workItemInfo.PostExecuteWorkItemCallback;
            WorkItemPriority = workItemInfo.WorkItemPriority;
            Timeout = workItemInfo.Timeout;
        }

        /// <summary>
        /// Get/Set if to use the caller's security context
        /// </summary>
        public bool UseCallerCallContext { get; set; }

        /// <summary>
        /// Get/Set if to use the caller's HTTP context
        /// </summary>
        public bool UseCallerHttpContext { get; set; }

        /// <summary>
        /// Get/Set if to dispose of the state object of a work item
        /// </summary>
        public bool DisposeOfStateObjects { get; set; }

        /// <summary>
        /// Get/Set the run the post execute options
        /// </summary>
        public CallToPostExecute CallToPostExecute { get; set; }

        /// <summary>
        /// Get/Set the post execute callback
        /// </summary>
        public PostExecuteWorkItemCallback PostExecuteWorkItemCallback { get; set; }

        /// <summary>
        /// Get/Set the work item's priority
        /// </summary>
        public WorkItemPriority WorkItemPriority { get; set; }

        /// <summary>
        /// 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!
        /// </summary>
        public long Timeout { get; set; }
    }

    #endregion
}