Пример #1
0
 private static void GetWaitHandles(IWaitableResult[] waitableResults, WaitHandle[] waitHandles)
 {
     for (int i = 0; i < waitableResults.Length; i++)
     {
         WorkItem.WorkItemResult workItemResult = waitableResults[i].GetWorkItemResult() as WorkItem.WorkItemResult;
         waitHandles[i] = workItemResult.GetWorkItem().GetWaitHandle();
     }
 }
Пример #2
0
 private static void ReleaseWaitHandles(IWaitableResult[] waitableResults)
 {
     for (int i = 0; i < waitableResults.Length; i++)
     {
         WorkItem.WorkItemResult workItemResult = (WorkItem.WorkItemResult)waitableResults[i].GetWorkItemResult();
         workItemResult.GetWorkItem().ReleaseWaitHandle();
     }
 }
Пример #3
0
 public WorkItem(IWorkItemsGroup workItemsGroup, WorkItemInfo workItemInfo, WorkItemCallback callback, object state)
 {
     this._workItemsGroup = workItemsGroup;
     this._workItemInfo   = workItemInfo;
     if (this._workItemInfo.UseCallerCallContext || this._workItemInfo.UseCallerHttpContext)
     {
         this._callerContext = CallerThreadContext.Capture(this._workItemInfo.UseCallerCallContext, this._workItemInfo.UseCallerHttpContext);
     }
     this._callback       = callback;
     this._state          = state;
     this._workItemResult = new WorkItem.WorkItemResult(this);
     this.Initialize();
 }