void worker_done_with_task() { MonitorLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag); _finished++; if (_finished == _num_workers) { // This will wake up all workers and not only the coordinator. _monitor->notify_all(); } }
void FreeIdSet::release_par_id(uint id) { MutexLockerEx x(_mon, Mutex::_no_safepoint_check_flag); assert(_ids[id] == claimed, "Precondition."); _ids[id] = _hd; _hd = id; _claimed--; if (_waiters > 0) { _mon->notify_all(); } }
void FreeIdSet::set_safepoint(bool b) { _safepoint = b; if (b) { for (int j = 0; j < NSets; j++) { if (_sets[j] != NULL && _sets[j]->_waiters > 0) { Monitor* mon = _sets[j]->_mon; mon->lock_without_safepoint_check(); mon->notify_all(); mon->unlock(); } } } }
void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers) { MutexLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag); _task = task; _num_workers = num_workers; // Tell the workers to get to work. _monitor->notify_all(); // Wait for them to finish. while (_finished < _num_workers) { _monitor->wait(/* no_safepoint_check */ true); } _task = NULL; _num_workers = 0; _started = 0; _finished = 0; }
bool notify_all() { if (_monitor != NULL) { return _monitor->notify_all(); } return true; }