77 name(), |
77 name(), |
78 total_workers()); |
78 total_workers()); |
79 } |
79 } |
80 _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal); |
80 _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal); |
81 if (gang_workers() == NULL) { |
81 if (gang_workers() == NULL) { |
82 vm_exit_out_of_memory(0, "Cannot create GangWorker array."); |
82 vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array."); |
83 return false; |
83 return false; |
84 } |
84 } |
85 os::ThreadType worker_type; |
85 os::ThreadType worker_type; |
86 if (are_ConcurrentGC_threads()) { |
86 if (are_ConcurrentGC_threads()) { |
87 worker_type = os::cgc_thread; |
87 worker_type = os::cgc_thread; |
91 for (uint worker = 0; worker < total_workers(); worker += 1) { |
91 for (uint worker = 0; worker < total_workers(); worker += 1) { |
92 GangWorker* new_worker = allocate_worker(worker); |
92 GangWorker* new_worker = allocate_worker(worker); |
93 assert(new_worker != NULL, "Failed to allocate GangWorker"); |
93 assert(new_worker != NULL, "Failed to allocate GangWorker"); |
94 _gang_workers[worker] = new_worker; |
94 _gang_workers[worker] = new_worker; |
95 if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { |
95 if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { |
96 vm_exit_out_of_memory(0, "Cannot create worker GC thread. Out of system resources."); |
96 vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, |
|
97 "Cannot create worker GC thread. Out of system resources."); |
97 return false; |
98 return false; |
98 } |
99 } |
99 if (!DisableStartThread) { |
100 if (!DisableStartThread) { |
100 os::start_thread(new_worker); |
101 os::start_thread(new_worker); |
101 } |
102 } |