File tree Expand file tree Collapse file tree 7 files changed +38
-13
lines changed Expand file tree Collapse file tree 7 files changed +38
-13
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ class Platform {
99
99
static void SetProcessName (const char * name);
100
100
101
101
DART_NORETURN static void Exit (int exit_code);
102
+ DART_NORETURN static void _Exit (int exit_code);
102
103
103
104
static void SetCoreDumpResourceLimit (int value);
104
105
Original file line number Diff line number Diff line change @@ -162,9 +162,12 @@ void Platform::SetProcessName(const char* name) {
162
162
void Platform::Exit (int exit_code) {
163
163
Console::RestoreConfig ();
164
164
Dart_PrepareToAbort ();
165
- // We're not doing a full VM shutdown with Dart_Cleanup, which might block,
166
- // and other VM threads may be accessing state with global destructors, so
167
- // we skip global destructors by using _exit instead of exit.
165
+ exit (exit_code);
166
+ }
167
+
168
+ void Platform::_Exit (int exit_code) {
169
+ Console::RestoreConfig ();
170
+ Dart_PrepareToAbort ();
168
171
_exit (exit_code);
169
172
}
170
173
Original file line number Diff line number Diff line change @@ -157,9 +157,12 @@ void Platform::SetProcessName(const char* name) {
157
157
void Platform::Exit (int exit_code) {
158
158
Console::RestoreConfig ();
159
159
Dart_PrepareToAbort ();
160
- // We're not doing a full VM shutdown with Dart_Cleanup, which might block,
161
- // and other VM threads may be accessing state with global destructors, so
162
- // we skip global destructors by using _exit instead of exit.
160
+ exit (exit_code);
161
+ }
162
+
163
+ void Platform::_Exit (int exit_code) {
164
+ Console::RestoreConfig ();
165
+ Dart_PrepareToAbort ();
163
166
_exit (exit_code);
164
167
}
165
168
Original file line number Diff line number Diff line change @@ -169,9 +169,12 @@ void Platform::SetProcessName(const char* name) {
169
169
void Platform::Exit (int exit_code) {
170
170
Console::RestoreConfig ();
171
171
Dart_PrepareToAbort ();
172
- // We're not doing a full VM shutdown with Dart_Cleanup, which might block,
173
- // and other VM threads may be accessing state with global destructors, so
174
- // we skip global destructors by using _exit instead of exit.
172
+ exit (exit_code);
173
+ }
174
+
175
+ void Platform::_Exit (int exit_code) {
176
+ Console::RestoreConfig ();
177
+ Dart_PrepareToAbort ();
175
178
_exit (exit_code);
176
179
}
177
180
Original file line number Diff line number Diff line change @@ -342,9 +342,12 @@ void Platform::SetProcessName(const char* name) {
342
342
void Platform::Exit (int exit_code) {
343
343
Console::RestoreConfig ();
344
344
Dart_PrepareToAbort ();
345
- // We're not doing a full VM shutdown with Dart_Cleanup, which might block,
346
- // and other VM threads may be accessing state with global destructors, so
347
- // we skip global destructors by using _exit instead of exit.
345
+ exit (exit_code);
346
+ }
347
+
348
+ void Platform::_Exit (int exit_code) {
349
+ Console::RestoreConfig ();
350
+ Dart_PrepareToAbort ();
348
351
_exit (exit_code);
349
352
}
350
353
Original file line number Diff line number Diff line change @@ -307,6 +307,15 @@ void Platform::Exit(int exit_code) {
307
307
::ExitProcess (exit_code);
308
308
}
309
309
310
+ void Platform::_Exit (int exit_code) {
311
+ // Restore the console's output code page
312
+ Console::RestoreConfig ();
313
+ // On Windows we use ExitProcess so that threads can't clobber the exit_code.
314
+ // See: https://code.google.com/p/nativeclient/issues/detail?id=2870
315
+ Dart_PrepareToAbort ();
316
+ ::ExitProcess (exit_code);
317
+ }
318
+
310
319
void Platform::SetCoreDumpResourceLimit (int value) {
311
320
// Not supported.
312
321
}
Original file line number Diff line number Diff line change @@ -263,7 +263,10 @@ void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
263
263
DartUtils::GetInt64Value (Dart_GetNativeArgument (args, 0 ), &status);
264
264
Process::RunExitHook (status);
265
265
Dart_ExitIsolate ();
266
- Platform::Exit (static_cast <int >(status));
266
+ // We're not doing a full VM shutdown with Dart_Cleanup, which might block,
267
+ // and other VM threads may be accessing state with global destructors, so
268
+ // we skip global destructors by using _exit instead of exit.
269
+ Platform::_Exit (static_cast <int >(status));
267
270
}
268
271
269
272
void FUNCTION_NAME (Process_SetExitCode)(Dart_NativeArguments args) {
You can’t perform that action at this time.
0 commit comments