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
3 files changed