Parallel shutdown
Decrease shutdown time by doing some shutdown tasks in parallel.
There are two threads executing during the shut down: the ShutdownThread
and a separate thread for the radio shutdown. However, the execution is
done in serial, as the ShutdownThread immediately joins on the radio
thread.
This commit will move the shutdown of the radio to the beginning of
shutdown and execute it in parallel to the shutdown of the rest of the
system.
The flow of the two threads during shutdown is now:
Radio Thread
* Start shutdown of the radio
* Wait for radio off or time out
* Notify that the radio is done
ShutdownThread
* Broadcast ACTION_SHUTDOWN as a parallel broadcast. (The receivers
will get as much time to handle onReceive as it takes execute the
rest of the tasks in the shut down flow. If they are not done in
that time, we don't care.)
* Shutdown ActivityManager
* Shutdown MountService
* Wait for MountService and radio to notify done
* Vibrate
* Low level shutdown
Change-Id: Ifdd8a9c75337fd9d00148a0d2b9917e10fa60634
Loading
Please register or sign in to comment