namespaceUnrealBuildTool{classActionThread{// ...publicoverrideboolExecuteActions(List<Action>Actions){// Time to sleep after each iteration of the loop in order to not busy wait.constfloatLoopSleepTime=0.1f;// Use WMI to figure out physical cores, excluding hyper threading.intNumCores=Utils.GetPhysicalProcessorCount();if(NumCores==-1){NumCores=System.Environment.ProcessorCount;}// The number of actions to execute in parallel is trying to keep the CPU busy enough in presence of I/O stalls.intMaxActionsToExecuteInParallel=0;if(NumCores<System.Environment.ProcessorCount&&BuildConfiguration.ProcessorCountMultiplier!=1.0){// The CPU has more logical cores than physical ones, aka uses hyper-threading. // Use multiplier if providedMaxActionsToExecuteInParallel=(int)(NumCores*BuildConfiguration.ProcessorCountMultiplier);}elseif(NumCores<System.Environment.ProcessorCount&&NumCores>4){// The CPU has more logical cores than physical ones, aka uses hyper-threading. // Use average of logical and physical if we have "lots of cores"MaxActionsToExecuteInParallel=(int)(NumCores+System.Environment.ProcessorCount)/2;}// No hyper-threading. Only kicking off a task per CPU to keep machine responsive.else{MaxActionsToExecuteInParallel=NumCores;}// ...}}}