diff options
| author | 2023-12-06 23:02:01 +0000 | |
|---|---|---|
| committer | 2023-12-06 23:02:01 +0000 | |
| commit | ef2e1643f5c771bfa9eabb8a98a37f8be96691af (patch) | |
| tree | c427115fd260b7f20d1d8b78ac5ecd5ed8501fd8 | |
| parent | 96b83024e4ec7b3986f9cefaa0990b01bc6010b8 (diff) | |
| parent | 4a9ad85bce956565939b16d2ad3c1d244fd8ec2f (diff) | |
Merge "Revert "lshal: do not pthread_kill"" into main
| -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}); } |