Add -Xzygote to suppress starting the signal catcher thread.
Change-Id: Iae98ac9d362c71074befbc702f8cae96888211ec
diff --git a/src/runtime.cc b/src/runtime.cc
index b4c25d3..4f463e5 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -31,6 +31,7 @@
Runtime::Runtime()
: verbose_startup_(false),
+ is_zygote_(false),
default_stack_size_(Thread::kDefaultStackSize),
thread_list_(NULL),
intern_table_(NULL),
@@ -205,6 +206,8 @@
parsed->heap_maximum_size_ = Heap::kMaximumSize;
parsed->stack_size_ = Thread::kDefaultStackSize;
+ parsed->is_zygote_ = false;
+
parsed->hook_vfprintf_ = vfprintf;
parsed->hook_exit_ = exit;
parsed->hook_abort_ = abort;
@@ -267,6 +270,8 @@
parsed->properties_.push_back(option.substr(strlen("-D")).data());
} else if (option.starts_with("-Xjnitrace:")) {
parsed->jni_trace_ = option.substr(strlen("-Xjnitrace:")).data();
+ } else if (option == "-Xzygote") {
+ parsed->is_zygote_ = true;
} else if (option.starts_with("-verbose:")) {
std::vector<std::string> verbose_options;
Split(option.substr(strlen("-verbose:")).data(), ',', verbose_options);
@@ -351,6 +356,10 @@
// come after ClassLinker::RunRootClinits.
started_ = true;
+ if (!is_zygote_) {
+ signal_catcher_ = new SignalCatcher;
+ }
+
StartDaemonThreads();
CreateSystemClassLoader();
@@ -363,7 +372,9 @@
}
void Runtime::StartDaemonThreads() {
- signal_catcher_ = new SignalCatcher;
+ if (IsVerboseStartup()) {
+ LOG(INFO) << "Runtime::StartDaemonThreads entering";
+ }
Thread* self = Thread::Current();
@@ -376,6 +387,10 @@
jmethodID mid = env->GetStaticMethodID(c.get(), "start", "()V");
CHECK(mid != NULL);
env->CallStaticVoidMethod(c.get(), mid);
+
+ if (IsVerboseStartup()) {
+ LOG(INFO) << "Runtime::StartDaemonThreads exiting";
+ }
}
bool Runtime::IsStarted() const {
@@ -400,6 +415,8 @@
class_path_ = options->class_path_;
properties_ = options->properties_;
+ is_zygote_ = options->is_zygote_;
+
vfprintf_ = options->hook_vfprintf_;
exit_ = options->hook_exit_;
abort_ = options->hook_abort_;
diff --git a/src/runtime.h b/src/runtime.h
index 65a54e9..462bb81 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -51,6 +51,7 @@
std::vector<std::string> images_;
bool check_jni_;
std::string jni_trace_;
+ bool is_zygote_;
size_t heap_initial_size_;
size_t heap_maximum_size_;
size_t stack_size_;
@@ -208,6 +209,7 @@
void StartDaemonThreads();
bool verbose_startup_;
+ bool is_zygote_;
// The host prefix is used during cross compilation. It is removed
// from the start of host paths such as: