Commit 639f6f17 authored by yangguo's avatar yangguo Committed by Commit bot

[d8] cleanly force exit in d8 on windows.

Using _exit on windows may cause race conditions in threads.

BUG=chromium:603131

Review-Url: https://codereview.chromium.org/2478473003
Cr-Commit-Position: refs/heads/master@{#40789}
parent 76bd4ff4
......@@ -772,4 +772,12 @@ void Shell::AddOSMethods(Isolate* isolate, Local<ObjectTemplate> os_templ) {
FunctionTemplate::New(isolate, RemoveDirectory));
}
void Shell::Exit(int exit_code) {
// Use _exit instead of exit to avoid races between isolate
// threads and static destructors.
fflush(stdout);
fflush(stderr);
_exit(exit_code);
}
} // namespace v8
......@@ -10,5 +10,12 @@ namespace v8 {
void Shell::AddOSMethods(Isolate* isolate, Local<ObjectTemplate> os_templ) {}
void Shell::Exit(int exit_code) {
// Use TerminateProcess avoid races between isolate threads and
// static destructors.
fflush(stdout);
fflush(stderr);
TerminateProcess(GetCurrentProcess(), exit_code);
}
} // namespace v8
......@@ -1569,16 +1569,6 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
return handle_scope.Escape(context);
}
void Shell::Exit(int exit_code) {
// Use _exit instead of exit to avoid races between isolate
// threads and static destructors.
fflush(stdout);
fflush(stderr);
_exit(exit_code);
}
struct CounterAndKey {
Counter* counter;
const char* key;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment