aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/WIGStartInfo.cs
blob: 150317fc01db3c58ec3e16464ea8ea89ea5ebc02 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Ami Bar
// amibar@gmail.com

namespace Amib.Threading
{
    /// <summary>
    /// Summary description for WIGStartInfo.
    /// </summary>
    public class WIGStartInfo
    {
        /// <summary>
        /// Use the caller's security context
        /// </summary>
        private bool _useCallerCallContext;

        /// <summary>
        /// Use the caller's HTTP context
        /// </summary>
        private bool _useCallerHttpContext;

        /// <summary>
        /// Dispose of the state object of a work item
        /// </summary>
        private bool _disposeOfStateObjects;

        /// <summary>
        /// The option to run the post execute
        /// </summary>
        private CallToPostExecute _callToPostExecute;

        /// <summary>
        /// A post execute callback to call when none is provided in 
        /// the QueueWorkItem method.
        /// </summary>
        private PostExecuteWorkItemCallback _postExecuteWorkItemCallback;

        /// <summary>
        /// Indicate the WorkItemsGroup to suspend the handling of the work items
        /// until the Start() method is called.
        /// </summary>
        private bool _startSuspended;

        public WIGStartInfo()
        {
            _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext;
            _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext;
            _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
            _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
            _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
            _startSuspended = SmartThreadPool.DefaultStartSuspended;
        }

        public WIGStartInfo(WIGStartInfo wigStartInfo)
        {
            _useCallerCallContext = wigStartInfo._useCallerCallContext;
            _useCallerHttpContext = wigStartInfo._useCallerHttpContext;
            _disposeOfStateObjects = wigStartInfo._disposeOfStateObjects;
            _callToPostExecute = wigStartInfo._callToPostExecute;
            _postExecuteWorkItemCallback = wigStartInfo._postExecuteWorkItemCallback;
            _startSuspended = wigStartInfo._startSuspended;
        }

        public bool UseCallerCallContext
        {
            get { return _useCallerCallContext; }
            set { _useCallerCallContext = value; }
        }

        public bool UseCallerHttpContext
        {
            get { return _useCallerHttpContext; }
            set { _useCallerHttpContext = value; }
        }

        public bool DisposeOfStateObjects
        {
            get { return _disposeOfStateObjects; }
            set { _disposeOfStateObjects = value; }
        }

        public CallToPostExecute CallToPostExecute
        {
            get { return _callToPostExecute; }
            set { _callToPostExecute = value; }
        }

        public PostExecuteWorkItemCallback PostExecuteWorkItemCallback
        {
            get { return _postExecuteWorkItemCallback; }
            set { _postExecuteWorkItemCallback = value; }
        }

        public bool StartSuspended
        {
            get { return _startSuspended; }
            set { _startSuspended = value; }
        }
    }
}