diff options
author | Yifan Hong <elsk@google.com> | 2023-12-06 23:22:47 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-06 23:22:47 +0000 |
commit | 584e277bcf36d95338d67254fb033d19ad367df7 (patch) | |
tree | cdf9a81a08f30905596ffc6f142f4f68781d8394 | |
parent | fee02e7d1720078fa02cee45c6f251e62368627e (diff) | |
parent | ef2e1643f5c771bfa9eabb8a98a37f8be96691af (diff) | |
download | native-584e277bcf36d95338d67254fb033d19ad367df7.tar.gz |
Merge "Revert "lshal: do not pthread_kill"" into main am: ef2e1643f5
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2863707
Change-Id: I92ab4dde66a947d67bba2347df9e644e088a5816
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | cmds/lshal/Timeout.h | 10 | ||||
-rw-r--r-- | cmds/lshal/main.cpp | 1 |
2 files changed, 3 insertions, 8 deletions
diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h index 012a5d54aa..e8d22d9b58 100644 --- a/cmds/lshal/Timeout.h +++ b/cmds/lshal/Timeout.h @@ -72,14 +72,10 @@ bool timeout(std::chrono::duration<R, P> delay, std::function<void(void)> &&func return false; } bool success = state.wait(now + delay); - if (success) { - pthread_join(thread, nullptr); - } else { - // b/311143089: Abandon this background thread. Resources for a detached - // thread are cleaned up when it is terminated. If the background thread - // is stalled, it will be terminated when returning from main(). - pthread_detach(thread); + if (!success) { + pthread_kill(thread, SIGINT); } + pthread_join(thread, nullptr); return success; } diff --git a/cmds/lshal/main.cpp b/cmds/lshal/main.cpp index a44f467bb1..366c9383a2 100644 --- a/cmds/lshal/main.cpp +++ b/cmds/lshal/main.cpp @@ -18,6 +18,5 @@ int main(int argc, char **argv) { using namespace ::android::lshal; - // Background pthreads from timeout() are destroyed upon returning from main(). return Lshal{}.main(Arg{argc, argv}); } |