[dart:io, win] Don't delete the process list mutex during shutdown.
The exit callback might fire during or after dart:io shutdown. TEST=ci (flaky) Bug: https://github.com/dart-lang/sdk/issues/60499 Change-Id: I950ef4a6ba1d99a8eafb55cb051a60f0cb097e71 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493485 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
5789ef3f58
commit
1dc1b015eb
@@ -159,7 +159,9 @@ class ProcessInfoList {
|
|||||||
HANDLE exit_pipe;
|
HANDLE exit_pipe;
|
||||||
bool success = LookupProcess(pid, &handle, &wait_handle, &exit_pipe);
|
bool success = LookupProcess(pid, &handle, &wait_handle, &exit_pipe);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
FATAL("Failed to lookup process in list of active processes");
|
// Failed to lookup process in list of active processes. This might happen
|
||||||
|
// if a child exits after dart:io shutdown.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// Unregister the event in a non-blocking way.
|
// Unregister the event in a non-blocking way.
|
||||||
BOOL ok = UnregisterWait(wait_handle);
|
BOOL ok = UnregisterWait(wait_handle);
|
||||||
@@ -1333,15 +1335,14 @@ void Process::ClearSignalHandlerByFd(intptr_t fd, Dart_Port port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProcessInfoList::Init() {
|
void ProcessInfoList::Init() {
|
||||||
active_processes_ = nullptr;
|
if (mutex_ == nullptr) {
|
||||||
ASSERT(ProcessInfoList::mutex_ == nullptr);
|
mutex_ = new Mutex();
|
||||||
ProcessInfoList::mutex_ = new Mutex();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessInfoList::Cleanup() {
|
void ProcessInfoList::Cleanup() {
|
||||||
ASSERT(ProcessInfoList::mutex_ != nullptr);
|
// Do not delete mutex_. A child process might exit during/after dart:io
|
||||||
delete ProcessInfoList::mutex_;
|
// shutdown.
|
||||||
ProcessInfoList::mutex_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::Init() {
|
void Process::Init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user