| 433 | } |
| 434 | |
| 435 | bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result, |
| 436 | std::vector<std::string> command, |
| 437 | std::string const& workingDirectory) |
| 438 | { |
| 439 | if (command.empty()) { |
| 440 | return false; |
| 441 | } |
| 442 | // Create process instance |
| 443 | { |
| 444 | std::lock_guard<std::mutex> lock(this->Proc_.Mutex); |
| 445 | this->Proc_.ROP = cm::make_unique<cmUVReadOnlyProcess>(); |
| 446 | this->Proc_.ROP->setup(&result, true, std::move(command), |
| 447 | workingDirectory); |
| 448 | } |
| 449 | // Send asynchronous process start request to libuv loop |
| 450 | this->Proc_.Request.send(); |
| 451 | // Wait until the process has been finished and destroyed |
| 452 | { |
| 453 | std::unique_lock<std::mutex> ulock(this->Proc_.Mutex); |
| 454 | while (this->Proc_.ROP) { |
| 455 | this->Proc_.Condition.wait(ulock); |
| 456 | } |
| 457 | } |
| 458 | return !result.error(); |
| 459 | } |
| 460 | |
| 461 | void cmWorkerPoolWorker::UVProcessStart(uv_async_t* handle) |
| 462 | { |