statsd: Fix unsafe signal api usage

pthread mutex are not signal-safety api calls.
Use self-pipe and a thread to monitor SIGTERM
to quit gracefully instead.

Ignore-AOSP-First: backported fix for vulnerabilities
Bug: 234152730
Bug: 256591441
Test: build and reboot
Change-Id: I4d7ddeb7b4cc10d5c6523f3f93780b862dd6bb78
Merged-In: I4d7ddeb7b4cc10d5c6523f3f93780b862dd6bb78
1 file changed