Merge "lshal: do not pthread_kill" into main
diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h
index e8d22d9..012a5d5 100644
--- a/cmds/lshal/Timeout.h
+++ b/cmds/lshal/Timeout.h
@@ -72,10 +72,14 @@
         return false;
     }
     bool success = state.wait(now + delay);
-    if (!success) {
-        pthread_kill(thread, SIGINT);
+    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);
     }
-    pthread_join(thread, nullptr);
     return success;
 }
 
diff --git a/cmds/lshal/main.cpp b/cmds/lshal/main.cpp
index 366c938..a44f467 100644
--- a/cmds/lshal/main.cpp
+++ b/cmds/lshal/main.cpp
@@ -18,5 +18,6 @@
 
 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});
 }