WorkItemInfo.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Ami Bar
  2. // amibar@gmail.com
  3. namespace Amib.Threading
  4. {
  5. #region WorkItemInfo class
  6. /// <summary>
  7. /// Summary description for WorkItemInfo.
  8. /// </summary>
  9. public class WorkItemInfo
  10. {
  11. /// <summary>
  12. /// Use the caller's security context
  13. /// </summary>
  14. private bool _useCallerCallContext;
  15. /// <summary>
  16. /// Use the caller's security context
  17. /// </summary>
  18. private bool _useCallerHttpContext;
  19. /// <summary>
  20. /// Dispose of the state object of a work item
  21. /// </summary>
  22. private bool _disposeOfStateObjects;
  23. /// <summary>
  24. /// The option to run the post execute
  25. /// </summary>
  26. private CallToPostExecute _callToPostExecute;
  27. /// <summary>
  28. /// A post execute callback to call when none is provided in
  29. /// the QueueWorkItem method.
  30. /// </summary>
  31. private PostExecuteWorkItemCallback _postExecuteWorkItemCallback;
  32. /// <summary>
  33. /// The priority of the work item
  34. /// </summary>
  35. private WorkItemPriority _workItemPriority;
  36. public WorkItemInfo()
  37. {
  38. _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext;
  39. _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext;
  40. _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
  41. _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
  42. _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
  43. _workItemPriority = SmartThreadPool.DefaultWorkItemPriority;
  44. }
  45. public WorkItemInfo(WorkItemInfo workItemInfo)
  46. {
  47. _useCallerCallContext = workItemInfo._useCallerCallContext;
  48. _useCallerHttpContext = workItemInfo._useCallerHttpContext;
  49. _disposeOfStateObjects = workItemInfo._disposeOfStateObjects;
  50. _callToPostExecute = workItemInfo._callToPostExecute;
  51. _postExecuteWorkItemCallback = workItemInfo._postExecuteWorkItemCallback;
  52. _workItemPriority = workItemInfo._workItemPriority;
  53. }
  54. public bool UseCallerCallContext
  55. {
  56. get { return _useCallerCallContext; }
  57. set { _useCallerCallContext = value; }
  58. }
  59. public bool UseCallerHttpContext
  60. {
  61. get { return _useCallerHttpContext; }
  62. set { _useCallerHttpContext = value; }
  63. }
  64. public bool DisposeOfStateObjects
  65. {
  66. get { return _disposeOfStateObjects; }
  67. set { _disposeOfStateObjects = value; }
  68. }
  69. public CallToPostExecute CallToPostExecute
  70. {
  71. get { return _callToPostExecute; }
  72. set { _callToPostExecute = value; }
  73. }
  74. public PostExecuteWorkItemCallback PostExecuteWorkItemCallback
  75. {
  76. get { return _postExecuteWorkItemCallback; }
  77. set { _postExecuteWorkItemCallback = value; }
  78. }
  79. public WorkItemPriority WorkItemPriority
  80. {
  81. get { return _workItemPriority; }
  82. set { _workItemPriority = value; }
  83. }
  84. }
  85. #endregion
  86. }