470 }
471 if (monitor() != NULL) {
472 delete monitor();
473 _monitor = NULL;
474 }
475 }
476
477 void GCTaskManager::set_active_gang() {
478 _active_workers =
479 AdaptiveSizePolicy::calc_active_workers(workers(),
480 active_workers(),
481 Threads::number_of_non_daemon_threads());
482
483 assert(!all_workers_active() || active_workers() == ParallelGCThreads,
484 err_msg("all_workers_active() is incorrect: "
485 "active %d ParallelGCThreads %d", active_workers(),
486 ParallelGCThreads));
487 if (TraceDynamicGCThreads) {
488 gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): "
489 "all_workers_active() %d workers %d "
490 "active %d ParallelGCThreads %d ",
491 all_workers_active(), workers(), active_workers(),
492 ParallelGCThreads);
493 }
494 }
495
496 // Create IdleGCTasks for inactive workers.
497 // Creates tasks in a ResourceArea and assumes
498 // an appropriate ResourceMark.
499 void GCTaskManager::task_idle_workers() {
500 {
501 int more_inactive_workers = 0;
502 {
503 // Stop any idle tasks from exiting their IdleGCTask's
504 // and get the count for additional IdleGCTask's under
505 // the GCTaskManager's monitor so that the "more_inactive_workers"
506 // count is correct.
507 MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
508 _idle_inactive_task->set_should_wait(true);
509 // active_workers are a number being requested. idle_workers
510 // are the number currently idle. If all the workers are being
|
470 }
471 if (monitor() != NULL) {
472 delete monitor();
473 _monitor = NULL;
474 }
475 }
476
477 void GCTaskManager::set_active_gang() {
478 _active_workers =
479 AdaptiveSizePolicy::calc_active_workers(workers(),
480 active_workers(),
481 Threads::number_of_non_daemon_threads());
482
483 assert(!all_workers_active() || active_workers() == ParallelGCThreads,
484 err_msg("all_workers_active() is incorrect: "
485 "active %d ParallelGCThreads %d", active_workers(),
486 ParallelGCThreads));
487 if (TraceDynamicGCThreads) {
488 gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): "
489 "all_workers_active() %d workers %d "
490 "active %d ParallelGCThreads " UINTX_FORMAT,
491 all_workers_active(), workers(), active_workers(),
492 ParallelGCThreads);
493 }
494 }
495
496 // Create IdleGCTasks for inactive workers.
497 // Creates tasks in a ResourceArea and assumes
498 // an appropriate ResourceMark.
499 void GCTaskManager::task_idle_workers() {
500 {
501 int more_inactive_workers = 0;
502 {
503 // Stop any idle tasks from exiting their IdleGCTask's
504 // and get the count for additional IdleGCTask's under
505 // the GCTaskManager's monitor so that the "more_inactive_workers"
506 // count is correct.
507 MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
508 _idle_inactive_task->set_should_wait(true);
509 // active_workers are a number being requested. idle_workers
510 // are the number currently idle. If all the workers are being
|