void PlotPredicateProperty::set(const std::vector<std::pair<int, PlotPredicate*> >& value) { clear(); for (size_t i = 0; i < value.size(); ++i) { value_.push_back(std::make_pair(value.at(i).first, value.at(i).second->clone())); } notifyAll(); }
void PlotEntitiesProperty::deletePlotEntitySettings(int index) { if (!dataEmpty()) { if (static_cast<size_t>(index) < value_.size()) value_.erase(value_.begin()+index); notifyAll(); } }
void PlotSelectionProperty::removeUnused() { for (size_t i = value_.size(); i > 0; --i) { if (!value_[i-1].highlight_ && !value_[i-1].renderLabel_ && !value_[i-1].zoomTo_) remove(i-1); } notifyAll(); }
void PlotSelectionProperty::remove(size_t index) { tgtAssert(index < value_.size(), "PlotSelectionProperty::remove(): index out of bounds!"); value_.erase(value_.begin() + index); updateZoomState(); applyHighlights(); notifyAll(); }
void LocalPrefServer::startNewGame() { PrefAssert( model != 0 ); model->StartNewBullet(); notifyAll(BulletStartedMessage(model->GetSettings())); startNewLayout(); }
void PlotSelectionProperty::set(const std::vector<PlotSelectionEntry>& value) { clear(); value_ = value; applyHighlights(); updateZoomState(); notifyAll(); }
void RecvThread::terminate() { _bTerminate = true; { tars::TC_ThreadLock::Lock sync(*this); notifyAll(); } }
void LocalPrefServer::processPlayerDrop(CardsSet drop, BidType deal) { for( int i = 0; i < NumOfPlayers; i++ ) { players[mapModelToRealPlayer(i)].Player->OnMessage( DropMessage(deal, i == model->Dealer() ? drop : EmptyCardsSet)); } notifyAll(DropMessage(deal, drop) ); }
bool PlotEntitiesProperty::setXColumnIndex(int index) { if (dataEmpty() || index < 0 || index >= data_->getColumnCount()) return false; else { xColumnIndex_ = index; notifyAll(); return true; } }
void TIDorb::core::poa::RequestQueue::deactivation() { TIDThr::Synchronized synchro(*this); if(!_deactivation) { _deactivation = true; notifyAll(); } };
void PropertyDimenReapThread::terminate() { LOG->debug() << "[PropertyDimenReapThread terminate.]" << endl; _bTerminate = true; TC_ThreadLock::Lock lock(*this); notifyAll(); }
bool PlotEntitiesProperty::setYColumnIndex(int index) { if (dataEmpty() || index >= data_->getColumnCount()) return false; else if (entities_ != PlotEntitySettings::SURFACE && entities_ != PlotEntitySettings::SCATTER) return false; else { yColumnIndex_ = index; notifyAll(); return true; } }
void PlotSelectionProperty::clearLastLabelFlag() { size_t i = value_.size(); while (i > 0 && !value_[i-1].renderLabel_) --i; if (i > 0) { value_[i-1].renderLabel_ = false; if (i > 1) value_[i-2].renderLabel_ = true; notifyAll(); } }
void notify_fix(bool lock) { if (!lock) BLINK_GPS_SEARCHING else { if (!is_fixed) { notifyAll(&wait_gps); } BLINK_NORMAL } is_fixed = lock; }
void PlotSelectionProperty::clearLastZoomFlag() { size_t i = value_.size(); while (i > 0 && !value_[i-1].zoomTo_) --i; if (i > 0) { value_[i-1].zoomTo_ = false; if (i > 1) value_[i-2].zoomTo_ = true; updateZoomState(); notifyAll(); } }
void PlotSelectionProperty::clearLastHighlightFlag() { size_t i = value_.size(); while (i > 0 && !value_[i-1].highlight_) --i; if (i > 0) { value_[i-1].highlight_ = false; if (i > 1) value_[i-2].highlight_ = true; applyHighlights(); notifyAll(); } }
void JobQueue::stop() { // stop accepting new jobs and clear all pending jobs { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); isQueueStopping_ = true; pendingJobs_.clear(); } std::vector<IceUtil::ThreadControl> controls; // first tell the workers to stop and cancel their jobs (if any) for ( size_t i=0; i<workerPool_.size(); ++i ) { if ( workerPool_[i] ) { // get the control object first controls.push_back( workerPool_[i]->getThreadControl() ); // Stop the worker first so it doesn't grab another job, when the current one is cancelled workerPool_[i]->stop(); // if it's working this will interrupt the job WorkerPtr w = WorkerPtr::dynamicCast( workerPool_[i] ); w->cancelJob(); } } // now the workers whose jobs were cancelled have already exited // those who are waiting needs to be woken up { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); notifyAll(); } // now all workers should be shutting down // make sure that we wait until they all exit for ( size_t i=0; i<controls.size(); ++i ) { // cout<<"JobQueue::stop(): waiting for thread "<<i<<endl; controls[i].join(); } // now we can forget about the workers // this is important because stop() may be called twice: by the end-user and the destructor for ( size_t i=0; i<workerPool_.size(); ++i ) { workerPool_[i] = 0; } }
void PlotSelectionProperty::set(PlotSelectionEntry entry, int index) { if (static_cast<size_t>(index) >= value_.size()) value_.push_back(entry); else { value_.erase(value_.begin()+index); value_.insert(value_.begin()+index, entry); } if (entry.highlight_) applyHighlights(); if (entry.zoomTo_) updateZoomState(); notifyAll(); }
void PlotSelectionProperty::clearLastFlag() { size_t i = value_.size(); while (i > 0 && !value_[i-1].zoomTo_ && !value_[i-1].highlight_ && !value_[i-1].renderLabel_) --i; if (i > 0) { value_[i-1].zoomTo_ = false; value_[i-1].highlight_ = false; value_[i-1].renderLabel_ = false; applyHighlights(); updateZoomState(); notifyAll(); } }
void PlotSelectionProperty::clearFlags(bool highlight, bool label, bool zoomTo) { for (std::vector<PlotSelectionEntry>::iterator it = value_.begin(); it < value_.end(); ++it) { if (zoomTo) it->zoomTo_ = false; if (highlight) it->highlight_ = false; if (label) it->renderLabel_ = false; } applyHighlights(); updateZoomState(); notifyAll(); }
YAC_LoggerThreadGroup::~YAC_LoggerThreadGroup() { flush(); _bTerminate = true; { Lock lock(*this); notifyAll(); } _tpool.stop(); _tpool.waitForAllDone(); }
int get(Buffer* b) { int m; enterMonitor(b->monitor); while (!b->full) { wait(); } m = b->message; b->full = 0; notifyAll(); exitMonitor(); return m; }
void QObjectHolder::takeOwner(QObject* obj){ lock(); Present* p=getFromMap(objects,obj); if (p!=NULL){ p->p=false; p->thread=QThread::currentThread(); notifyAll(); p=getFromMap(objects,obj); while (p!=NULL){ wait(); p=getFromMap(objects,obj); } } unlock(); }
void PlotEntitiesProperty::setPlotEntitySettings(PlotEntitySettings settings, int index) { if (entities_ == settings.getEntity()) { if (!dataEmpty()) { //new entity if (static_cast<size_t>(index) >= value_.size()) value_.push_back(settings); else { value_.erase(value_.begin()+index); value_.insert(value_.begin()+index, settings); } notifyAll(); } } else throw VoreenException("PlotEntitiesProperty::setPlotEntity: entities do not fit"); }
// Change the thread mode, and mark the given (or calling) thread as // the current thread for this proxy, depending on the thread mode. // // We have three thread modes: Normal, Sticky, and Exclusive. For more // details, see the help for CmdThread. In short, in Normal mode any // thread may hit and process an interrupt. The first thread to hit an // interrupt becomes the current thread, and all others block until // the current thread is done with its interrupt. // // In Exclusive mode, only the current thread may process interrupts; // All others will ignore interrupts. In Sticky mode, the current // thread continues to block others (even while running) until the // mode is switched back to Normal. void DebuggerProxy::switchThreadMode(ThreadMode mode, int64_t threadId /* = 0 */) { TRACE(2, "DebuggerProxy::switchThreadMode\n"); Lock lock(this); m_threadMode = mode; if (threadId) { m_thread = threadId; notifyAll(); // since threadId != 0, we're still waking up just one thread } else if (mode == Normal) { m_thread = 0; notify(); } else { m_thread = (int64_t)Process::GetThreadId(); } TRACE(2, "Current thread is now %" PRIx64 "\n", m_thread); }
void RawInput::listen() { struct input_event ev; for(;;) { int ret = epoll_wait(efd, &ee, 1000, -1); read(fd, &ev, sizeof(ev)); if (ev.value == 1) { if(ev.code > sizeof(keys) / sizeof(keys[0])) { std::cerr << "<4>Unknown key code: " << ev.code << "\n"; } else { notifyAll(keys[ev.code]); } } } }
int get(Buffer* b) { printf("get\n"); int m; enterMonitor(b->monitor); while (!b->full) { wait(); } printf("got\n"); m = b->message; b->full = 0; notifyAll(); exitMonitor(); return m; }
bool SqlConnection::DataCommand::Step() { // Notify all after potentially synchronized database connection access ScopedNotifyAll notifyAll( m_masterConnection->m_synchronizationObject.Get()); for (;;) { int ret = sqlite3_step(m_stmt); if (ret == SQLITE_ROW) { LogPedantic("SQL data command step ROW"); return true; } else if (ret == SQLITE_DONE) { LogPedantic("SQL data command step DONE"); return false; } else if (ret == SQLITE_BUSY) { LogPedantic("Collision occurred while executing SQL command"); // Synchronize if synchronization object is available if (m_masterConnection->m_synchronizationObject) { LogPedantic("Performing synchronization"); m_masterConnection-> m_synchronizationObject->Synchronize(); continue; } // No synchronization object defined. Fail. } // Fatal error const char *error = sqlite3_errmsg(m_masterConnection->m_connection); LogPedantic("SQL step data command failed"); LogPedantic(" Error: " << error); ThrowMsg(Exception::InternalError, error); } }
int timedGet(Buffer *b, int timeout) { int m, ret; enterMonitor(b->monitor); if (!b->full) { ret = timedWait(timeout); } if (ret) { m = b->message; b->full = 0; notifyAll(); } else { m = TIMEOUT; } exitMonitor(); return m; }
void DebuggerProxy::switchThreadMode(ThreadMode mode, int64_t threadId /* = 0 */) { TRACE(2, "DebuggerProxy::switchThreadMode\n"); Lock lock(this); m_threadMode = mode; if (threadId) { m_thread = threadId; m_newThread.reset(); notifyAll(); // since threadId != 0, we're still waking up just one thread } else if (mode == Normal) { m_thread = 0; notify(); } else { m_thread = (int64_t)Process::GetThreadId(); } if (mode == Normal) { m_flow.reset(); } }