Пример #1
0
 internal int [] GetWaitingTasksData(List <BuildRequest[]> outstandingRequests)
 {
     int[] waitingTasksArray;
     lock (waitingTasks)
     {
         waitingTasksArray = new int[waitingTasks.Keys.Count];
         int i = 0;
         foreach (DictionaryEntry entry in waitingTasks)
         {
             // Store the node proxy
             waitingTasksArray[i] = (int)entry.Key;
             // Loop through the build requests and add uncomplete requests to the list
             WaitingTaskData     taskData = (WaitingTaskData)entry.Value;
             List <BuildRequest> requests = new List <BuildRequest>();
             for (int j = 0; j < taskData.buildRequests.Length; j++)
             {
                 if (taskData.buildResults[j] == null)
                 {
                     requests.Add(taskData.buildRequests[j]);
                 }
             }
             outstandingRequests.Add(requests.ToArray());
             // Move to the next output entry
             i++;
         }
     }
     return(waitingTasksArray);
 }
Пример #2
0
        /// <summary>
        /// This function is called when the task executes a callback via IBuildEngine interface. A thread
        /// that currently owns the workitem queue will continue to own it, unless a work item comes in while
        /// it is inside the callback. A thread that enters the callback no longer owns the current directory and
        /// environment block, but it will always regain them before returning to the task.
        /// </summary>
        internal void WaitForResults
        (
            int handleId,
            BuildResult[] buildResults,
            BuildRequest [] buildRequests
        )
        {
            TaskWorkerThread workerThread = GetWorkerThreadForHandleId(handleId);

            ErrorUtilities.VerifyThrow(workerThread != null, "Worker thread should be in the table");
            WaitingTaskData taskData = new WaitingTaskData(buildRequests, buildResults);

            lock (waitingTasks)
            {
                waitingTasks.Add(handleId, taskData);
            }
            workerThread.NodeActionLoop(workerThread.threadActive ? NodeLoopExecutionMode.WaitingActiveThread :
                                        NodeLoopExecutionMode.WaitingPassiveThread,
                                        handleId, buildResults);
            lock (waitingTasks)
            {
                waitingTasks.Remove(handleId);
            }
        }
Пример #3
0
 /// <summary>
 /// This function is called when the task executes a callback via IBuildEngine interface. A thread
 /// that currently owns the workitem queue will continue to own it, unless a work item comes in while
 /// it is inside the callback. A thread that enters the callback no longer owns the current directory and
 /// environment block, but it will always regain them before returning to the task.
 /// </summary>
 internal void WaitForResults
 (
     int handleId, 
     BuildResult[] buildResults,
     BuildRequest [] buildRequests
 )
 {
     TaskWorkerThread workerThread = GetWorkerThreadForHandleId(handleId);
     ErrorUtilities.VerifyThrow(workerThread != null, "Worker thread should be in the table");
     WaitingTaskData taskData = new WaitingTaskData(buildRequests, buildResults);
     lock (waitingTasks)
     {
         waitingTasks.Add(handleId, taskData);
     }
     workerThread.NodeActionLoop(workerThread.threadActive ? NodeLoopExecutionMode.WaitingActiveThread : 
                                 NodeLoopExecutionMode.WaitingPassiveThread,
                                 handleId, buildResults);
     lock (waitingTasks)
     {
         waitingTasks.Remove(handleId);
     }
 }