Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9e509aba authored by Yifan Hong's avatar Yifan Hong
Browse files

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
parent 7b05d26f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment