diff options
author | yawanng <yawanng@google.com> | 2020-06-22 20:48:42 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-22 20:48:42 +0000 |
commit | 0b3a7fe4d104ef33c2a1ea8d4a2cff916050c992 (patch) | |
tree | 5efd21c428d07be6da38823f3ea4505e67cb772f | |
parent | 8317bff37184ce9a932a8d0c7f669d97bfc21b20 (diff) | |
parent | 82a0ea914bbdb3189503726fc86b3408f3e0b86b (diff) | |
download | iorap-0b3a7fe4d104ef33c2a1ea8d4a2cff916050c992.tar.gz |
maintenance: Fix the dangling reference to function parameters. am: 2c3b9c0082 am: 82a0ea914b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/iorap/+/11931583
Change-Id: I7fa363095af7b4d262f13cc561b8077a1528a5d1
-rw-r--r-- | src/maintenance/controller.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/maintenance/controller.cc b/src/maintenance/controller.cc index 6ba119c..639f402 100644 --- a/src/maintenance/controller.cc +++ b/src/maintenance/controller.cc @@ -128,7 +128,7 @@ std::vector<std::string> MakeCompilerParams(const CompilerForkParameters& params // Sets a watch dog for the given pid and kill it if timeout. std::thread SetTimeoutWatchDog(pid_t pid, int64_t timeout_ms, std::atomic<bool>& cancel_watchdog) { - std::thread watchdog_thread{[&]() { + std::thread watchdog_thread{[pid, timeout_ms, &cancel_watchdog]() { std::chrono::time_point start = std::chrono::system_clock::now(); std::chrono::milliseconds timeout(timeout_ms); while (!cancel_watchdog) { @@ -140,6 +140,12 @@ std::thread SetTimeoutWatchDog(pid_t pid, int64_t timeout_ms, std::atomic<bool>& std::chrono::time_point cur = std::chrono::system_clock::now(); if (cur - start > timeout) { LOG(INFO) << "Process (" << pid << ") is timeout!"; + LOG(INFO) << "start time: " + << std::chrono::system_clock::to_time_t(start) + << " end time: " + << std::chrono::system_clock::to_time_t(cur) + << " timeout: " + << timeout_ms; kill(pid, SIGKILL); break; } |