trunks: Stop background thread when exiting trunksd

The background thread may access and holds references to
BackgroundCommandTransceiver, ResourceManager and other objects,
created by the main thread. Stop the background thread
before these objects are destroyed when the daemon exits.

BUG=chromium:754813
BUG=chromium:752811
TEST=reboot without trunksd coredump in /var/spool/crash

Change-Id: I0ed0a2a6853114066a683ae6be977dcc977b4c34
Reviewed-on: https://chromium-review.googlesource.com/612265
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
1 file changed