Use _exit instead of exit for the system exit.
We get DCHECK failures in ~Mutex() called from an atexit handler on
System.exit() in some tests. To avoid it, use _exit instead of exit.
Bug: 28106055
Change-Id: I2a6d2ad8170327553c9c9f0049829e3fd3937180
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 6db0cb2..635ff51 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -129,8 +129,10 @@
RUNTIME_OPTIONS_KEY (bool (*)(), HookIsSensitiveThread)
RUNTIME_OPTIONS_KEY (int32_t (*)(FILE* stream, const char* format, va_list ap), \
HookVfprintf, vfprintf)
+// Use _exit instead of exit so that we won't get DCHECK failures in global data
+// destructors. b/28106055.
RUNTIME_OPTIONS_KEY (void (*)(int32_t status), \
- HookExit, exit)
+ HookExit, _exit)
// We don't call abort(3) by default; see
// Runtime::Abort.
RUNTIME_OPTIONS_KEY (void (*)(), HookAbort, nullptr)