lshal: use std::async

All of the commands are executed by starting a thread,
and if there is a timeout, sending a SIGINT to the thread,
which invokes pthread_exit from the signal handler. If
pthread_exit is called while the thread is in jemalloc code,
that might cause problems.

Use a standard library std::async function to avoid handling
pthread's manually. This avoids calling pthread_kill(). If
the function times out, simply ignore the future object and
move on. Although this causes memory leak, the lshal tool is
a debugging tool that is intended to run for a short period of
time, not as a daemon. So this is okay.

Test: lshal_test
Bug: 311143089
Change-Id: Id1092fbc3992c62c13c66ddac18105e8dcd6fc81
diff --git a/cmds/lshal/main.cpp b/cmds/lshal/main.cpp
index 366c938..bd5fa32 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;
-    return Lshal{}.main(Arg{argc, argv});
+    // Use _exit() to force terminate background threads in Timeout.h
+    _exit(Lshal{}.main(Arg{argc, argv}));
 }