Cleanup some of the thread merging.
Adds an optimization for checking whether a looper is stuck, with a new Looper method to see if its thread is currently idle. This will allow us to put a large number of loopers in the monitor efficiently, since we generally won't have to do a context switch on each of them (since most looper threads spend most of their time idle waiting for work). Also change things so the system process's main thread is actually running on the main thread. Because Jeff asked for this, and who am I to argue? :) Change-Id: I12999e6f9c4b056c22dd652cb78c2453c391061f
This commit is contained in:
@@ -75,7 +75,7 @@ import java.io.File;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
class ServerThread extends Thread {
|
||||
class ServerThread {
|
||||
private static final String TAG = "SystemServer";
|
||||
private static final String ENCRYPTING_STATE = "trigger_restart_min_framework";
|
||||
private static final String ENCRYPTED_STATE = "1";
|
||||
@@ -87,8 +87,7 @@ class ServerThread extends Thread {
|
||||
Log.wtf(TAG, "BOOT FAILURE " + msg, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
public void initAndLoop() {
|
||||
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN,
|
||||
SystemClock.uptimeMillis());
|
||||
|
||||
@@ -1119,8 +1118,10 @@ public class SystemServer {
|
||||
|
||||
public static final void init2() {
|
||||
Slog.i(TAG, "Entered the Android system server!");
|
||||
Thread thr = new ServerThread();
|
||||
thr.setName("android.server.ServerThread");
|
||||
thr.start();
|
||||
|
||||
// This used to be its own separate thread, but now it is
|
||||
// just the loop we run on the main thread.
|
||||
ServerThread thr = new ServerThread();
|
||||
thr.initAndLoop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user