d8c9b08925
There are problems calling WaitForRunningWorkers when we call quit(). First, suppose the main thread first calls quit(), and the worker thread calls quit() after the main thread calls quit(), then sched_yield to wait for quit_once_ updated to ONCE_STATE_DONE. However the main thread is WaitForRunningWorkers to wait for the worker thread to join, thus causing deadlock. Second, suppose the worker thread calls quit() and empty the running_workers_ by WaitForRunningWorkers, then the main thread calls `onExit(isolate, true)` to dispose the platform and other global data, which will crash other running workers. Bug: v8:12219 Change-Id: I333e5aad431daefb1c163f69e66d8e9d5e9bf754 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3518908 Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/main@{#79525}
12 lines
306 B
JavaScript
12 lines
306 B
JavaScript
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
function quitInWorker() {
|
|
quit();
|
|
};
|
|
|
|
for(let i = 0; i < 10; i++){
|
|
new Worker(quitInWorker, ({type : 'function', arguments : []}));
|
|
}
|