Merge "Avoid starting multiple threads in ShutdownThread" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
70736a6d92
@@ -84,7 +84,7 @@ public final class ShutdownThread extends Thread {
|
|||||||
public static void shutdown(final Context context, boolean confirm) {
|
public static void shutdown(final Context context, boolean confirm) {
|
||||||
// ensure that only one thread is trying to power down.
|
// ensure that only one thread is trying to power down.
|
||||||
// any additional calls are just returned
|
// any additional calls are just returned
|
||||||
synchronized (sIsStartedGuard){
|
synchronized (sIsStartedGuard) {
|
||||||
if (sIsStarted) {
|
if (sIsStarted) {
|
||||||
Log.d(TAG, "Request to shutdown already running, returning.");
|
Log.d(TAG, "Request to shutdown already running, returning.");
|
||||||
return;
|
return;
|
||||||
@@ -133,6 +133,10 @@ public final class ShutdownThread extends Thread {
|
|||||||
|
|
||||||
private static void beginShutdownSequence(Context context) {
|
private static void beginShutdownSequence(Context context) {
|
||||||
synchronized (sIsStartedGuard) {
|
synchronized (sIsStartedGuard) {
|
||||||
|
if (sIsStarted) {
|
||||||
|
Log.d(TAG, "Request to shutdown already running, returning.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
sIsStarted = true;
|
sIsStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user