mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:43:57 +00:00
[vm, io] Restore global destructors for normal shutdown path.
Cf. ef4984566b
.
TEST=samples/hello_world
Bug: https://github.com/dart-lang/samples/issues/195
Change-Id: I05cac92500a912c5d3e0771f626878decac18a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324267
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
b8ee3a9996
commit
53fb57ea5e
|
@ -99,6 +99,7 @@ class Platform {
|
|||
static void SetProcessName(const char* name);
|
||||
|
||||
DART_NORETURN static void Exit(int exit_code);
|
||||
DART_NORETURN static void _Exit(int exit_code);
|
||||
|
||||
static void SetCoreDumpResourceLimit(int value);
|
||||
|
||||
|
|
|
@ -162,9 +162,12 @@ void Platform::SetProcessName(const char* name) {
|
|||
void Platform::Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
|
||||
// and other VM threads may be accessing state with global destructors, so
|
||||
// we skip global destructors by using _exit instead of exit.
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
void Platform::_Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
_exit(exit_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -157,9 +157,12 @@ void Platform::SetProcessName(const char* name) {
|
|||
void Platform::Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
|
||||
// and other VM threads may be accessing state with global destructors, so
|
||||
// we skip global destructors by using _exit instead of exit.
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
void Platform::_Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
_exit(exit_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -169,9 +169,12 @@ void Platform::SetProcessName(const char* name) {
|
|||
void Platform::Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
|
||||
// and other VM threads may be accessing state with global destructors, so
|
||||
// we skip global destructors by using _exit instead of exit.
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
void Platform::_Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
_exit(exit_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -342,9 +342,12 @@ void Platform::SetProcessName(const char* name) {
|
|||
void Platform::Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
|
||||
// and other VM threads may be accessing state with global destructors, so
|
||||
// we skip global destructors by using _exit instead of exit.
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
void Platform::_Exit(int exit_code) {
|
||||
Console::RestoreConfig();
|
||||
Dart_PrepareToAbort();
|
||||
_exit(exit_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -307,6 +307,15 @@ void Platform::Exit(int exit_code) {
|
|||
::ExitProcess(exit_code);
|
||||
}
|
||||
|
||||
void Platform::_Exit(int exit_code) {
|
||||
// Restore the console's output code page
|
||||
Console::RestoreConfig();
|
||||
// On Windows we use ExitProcess so that threads can't clobber the exit_code.
|
||||
// See: https://code.google.com/p/nativeclient/issues/detail?id=2870
|
||||
Dart_PrepareToAbort();
|
||||
::ExitProcess(exit_code);
|
||||
}
|
||||
|
||||
void Platform::SetCoreDumpResourceLimit(int value) {
|
||||
// Not supported.
|
||||
}
|
||||
|
|
|
@ -263,7 +263,10 @@ void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
|
|||
DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
|
||||
Process::RunExitHook(status);
|
||||
Dart_ExitIsolate();
|
||||
Platform::Exit(static_cast<int>(status));
|
||||
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
|
||||
// and other VM threads may be accessing state with global destructors, so
|
||||
// we skip global destructors by using _exit instead of exit.
|
||||
Platform::_Exit(static_cast<int>(status));
|
||||
}
|
||||
|
||||
void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
|
||||
|
|
Loading…
Reference in a new issue