本文整理汇总了C++中Monitor::notify_all方法的典型用法代码示例。如果您正苦于以下问题:C++ Monitor::notify_all方法的具体用法?C++ Monitor::notify_all怎么用?C++ Monitor::notify_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::notify_all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: worker_done_with_task
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();
}
}
示例2: release_par_id
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();
}
}
示例3: set_safepoint
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();
}
}
}
}
示例4: coordinator_execute_on_workers
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;
}
示例5: notify_all
bool notify_all() {
if (_monitor != NULL) {
return _monitor->notify_all();
}
return true;
}