mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
Merge branch '_8373253' into _8367993
This commit is contained in:
commit
2e370ce1bd
@ -93,7 +93,24 @@ void WorkerThreads::initialize_workers() {
|
||||
}
|
||||
}
|
||||
|
||||
bool WorkerThreads::allow_inject_creation_failure() const {
|
||||
if (!is_init_completed()) {
|
||||
// Never allow creation failures during VM init
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_created_workers == 0) {
|
||||
// Never allow creation failures of the first worker, it will cause the VM to exit
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WorkerThread* WorkerThreads::create_worker(uint name_suffix) {
|
||||
if (InjectGCWorkerCreationFailure && allow_inject_creation_failure()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WorkerThread* const worker = new WorkerThread(_name, name_suffix, &_dispatcher);
|
||||
|
||||
@ -114,13 +131,6 @@ uint WorkerThreads::set_active_workers(uint num_workers) {
|
||||
"Invalid number of active workers %u (should be 1-%u)",
|
||||
num_workers, _max_workers);
|
||||
|
||||
if (_created_workers > 0 && InjectGCWorkerCreationFailure) {
|
||||
assert(is_init_completed(), "Initialization not completed");
|
||||
log_error(gc, task)("Failed to create worker thread (InjectGCWorkerCreationFailure)");
|
||||
_active_workers = MIN2(_created_workers, num_workers);
|
||||
return _active_workers;
|
||||
}
|
||||
|
||||
while (_created_workers < num_workers) {
|
||||
WorkerThread* const worker = create_worker(_created_workers);
|
||||
if (worker == nullptr) {
|
||||
|
||||
@ -103,6 +103,7 @@ public:
|
||||
WorkerThreads(const char* name, uint max_workers);
|
||||
|
||||
void initialize_workers();
|
||||
bool allow_inject_creation_failure() const;
|
||||
|
||||
uint max_workers() const { return _max_workers; }
|
||||
uint created_workers() const { return _created_workers; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user