< prev index next >

src/share/vm/gc/shared/workgroup.cpp

Print this page
rev 11459 : create_thread_failed: fix errors from thread creation failures


 254                    uint  workers,
 255                    bool  are_GC_task_threads,
 256                    bool  are_ConcurrentGC_threads) :
 257     AbstractWorkGang(name, workers, are_GC_task_threads, are_ConcurrentGC_threads),
 258     _dispatcher(create_dispatcher())
 259 { }
 260 
 261 AbstractGangWorker* WorkGang::allocate_worker(uint worker_id) {
 262   return new GangWorker(this, worker_id);
 263 }
 264 
 265 void WorkGang::run_task(AbstractGangTask* task) {
 266   run_task(task, active_workers());
 267 }
 268 
 269 void WorkGang::run_task(AbstractGangTask* task, uint num_workers) {
 270   guarantee(num_workers <= total_workers(),
 271             "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
 272             task->name(), num_workers, total_workers());
 273   guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
 274   add_workers(num_workers, false);
 275   _dispatcher->coordinator_execute_on_workers(task, num_workers);



 276 }
 277 
 278 AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {
 279   _gang = gang;
 280   set_id(id);
 281   set_name("%s#%d", gang->name(), id);
 282 }
 283 
 284 void AbstractGangWorker::run() {
 285   initialize();
 286   loop();
 287 }
 288 
 289 void AbstractGangWorker::initialize() {
 290   this->record_stack_base_and_size();
 291   this->initialize_named_thread();
 292   assert(_gang != NULL, "No gang to run in");
 293   os::set_priority(this, NearMaxPriority);
 294   log_develop_trace(gc, workgang)("Running gang worker for gang %s id %u", gang()->name(), id());
 295   // The VM thread should not execute here because MutexLocker's are used




 254                    uint  workers,
 255                    bool  are_GC_task_threads,
 256                    bool  are_ConcurrentGC_threads) :
 257     AbstractWorkGang(name, workers, are_GC_task_threads, are_ConcurrentGC_threads),
 258     _dispatcher(create_dispatcher())
 259 { }
 260 
 261 AbstractGangWorker* WorkGang::allocate_worker(uint worker_id) {
 262   return new GangWorker(this, worker_id);
 263 }
 264 
 265 void WorkGang::run_task(AbstractGangTask* task) {
 266   run_task(task, active_workers());
 267 }
 268 
 269 void WorkGang::run_task(AbstractGangTask* task, uint num_workers) {
 270   guarantee(num_workers <= total_workers(),
 271             "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
 272             task->name(), num_workers, total_workers());
 273   guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
 274   // num_workers may have been calculated based on different criteria
 275   // than _active_workers so use num_workers limited by the number of
 276   // created workers.
 277   uint active_workers = MIN2(_created_workers, num_workers);
 278   _dispatcher->coordinator_execute_on_workers(task, active_workers);
 279 }
 280 
 281 AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {
 282   _gang = gang;
 283   set_id(id);
 284   set_name("%s#%d", gang->name(), id);
 285 }
 286 
 287 void AbstractGangWorker::run() {
 288   initialize();
 289   loop();
 290 }
 291 
 292 void AbstractGangWorker::initialize() {
 293   this->record_stack_base_and_size();
 294   this->initialize_named_thread();
 295   assert(_gang != NULL, "No gang to run in");
 296   os::set_priority(this, NearMaxPriority);
 297   log_develop_trace(gc, workgang)("Running gang worker for gang %s id %u", gang()->name(), id());
 298   // The VM thread should not execute here because MutexLocker's are used


< prev index next >