< prev index next >

src/share/vm/utilities/yieldingWorkgroup.cpp

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.


 103   gangs. Once this works well, we will in a second
 104   iteration.refinement introduce flexibility into
 105   the work gang.
 106 
 107 NOTE: we can always create a new gang per each iteration
 108   in order to get the flexibility, but we will for now
 109   desist that simplified route.
 110 
 111  */
 112 /////////////////////
 113 void YieldingFlexibleWorkGang::start_task(YieldingFlexibleGangTask* new_task) {
 114   MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
 115   assert(task() == NULL, "Gang currently tied to a task");
 116   assert(new_task != NULL, "Null task");
 117   // Bind task to gang
 118   _task = new_task;
 119   new_task->set_gang(this);  // Establish 2-way binding to support yielding
 120   _sequence_number++;
 121 
 122   uint requested_size = new_task->requested_size();
 123   assert(requested_size >= 0, "Should be non-negative");
 124   if (requested_size != 0) {
 125     _active_workers = MIN2(requested_size, total_workers());
 126   } else {
 127     _active_workers = active_workers();
 128   }
 129   new_task->set_actual_size(_active_workers);
 130   new_task->set_for_termination(_active_workers);
 131 
 132   assert(_started_workers == 0, "Tabula rasa non");
 133   assert(_finished_workers == 0, "Tabula rasa non");
 134   assert(_yielded_workers == 0, "Tabula rasa non");
 135   yielding_task()->set_status(ACTIVE);
 136 
 137   // Wake up all the workers, the first few will get to work,
 138   // and the rest will go back to sleep
 139   monitor()->notify_all();
 140   wait_for_gang();
 141 }
 142 
 143 void YieldingFlexibleWorkGang::wait_for_gang() {




 103   gangs. Once this works well, we will in a second
 104   iteration.refinement introduce flexibility into
 105   the work gang.
 106 
 107 NOTE: we can always create a new gang per each iteration
 108   in order to get the flexibility, but we will for now
 109   desist that simplified route.
 110 
 111  */
 112 /////////////////////
 113 void YieldingFlexibleWorkGang::start_task(YieldingFlexibleGangTask* new_task) {
 114   MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
 115   assert(task() == NULL, "Gang currently tied to a task");
 116   assert(new_task != NULL, "Null task");
 117   // Bind task to gang
 118   _task = new_task;
 119   new_task->set_gang(this);  // Establish 2-way binding to support yielding
 120   _sequence_number++;
 121 
 122   uint requested_size = new_task->requested_size();

 123   if (requested_size != 0) {
 124     _active_workers = MIN2(requested_size, total_workers());
 125   } else {
 126     _active_workers = active_workers();
 127   }
 128   new_task->set_actual_size(_active_workers);
 129   new_task->set_for_termination(_active_workers);
 130 
 131   assert(_started_workers == 0, "Tabula rasa non");
 132   assert(_finished_workers == 0, "Tabula rasa non");
 133   assert(_yielded_workers == 0, "Tabula rasa non");
 134   yielding_task()->set_status(ACTIVE);
 135 
 136   // Wake up all the workers, the first few will get to work,
 137   // and the rest will go back to sleep
 138   monitor()->notify_all();
 139   wait_for_gang();
 140 }
 141 
 142 void YieldingFlexibleWorkGang::wait_for_gang() {


< prev index next >