bool DispatcherQueue::startQueueThread () { DispatcherThread * thread = (*createDispatcherThread)(this, _threadData); if (! _affinityCores.empty()) { size_t c = _affinityCores[_affinityPos]; LOG_DEBUG("using core %d for standard dispatcher thread", (int) c); thread->setProcessorAffinity(c); ++_affinityPos; if (_affinityPos >= _affinityCores.size()) { _affinityPos = 0; } } bool ok = thread->start(); if (! ok) { LOG_FATAL_AND_EXIT("cannot start dispatcher thread"); } else { _nrStarted++; _lastChanged = TRI_microtime(); } return ok; }
DWORD WINAPI DispatcherThread::DispatcherThreadStarter(void* param) { DispatcherThread* self = (DispatcherThread*)param; //printf("Thread %d started\n", self->threadId_); self->dispatch(); return TRUE; }
~ModuleSQL() { for (std::map<Anope::string, MySQLService *>::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end(); ++it) delete it->second; MySQLServices.clear(); DThread->SetExitState(); DThread->Wakeup(); DThread->Join(); delete DThread; }
bool DispatcherQueue::startQueueThread () { DispatcherThread * thread = (*createDispatcherThread)(this); bool ok = thread->start(); if (! ok) { LOGGER_FATAL_AND_EXIT("cannot start dispatcher thread"); } else { _nrStarted++; } return ok; }
bool DispatcherQueue::startQueueThread () { DispatcherThread * thread = (*createDispatcherThread)(this, _threadData); bool ok = thread->start(); if (! ok) { LOG_FATAL_AND_EXIT("cannot start dispatcher thread"); } else { _nrStarted++; _lastChanged = TRI_microtime(); } return ok; }
ModuleSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR) { me = this; DThread = new DispatcherThread(); DThread->Start(); }
void DispatcherQueue::startQueueThread () { DispatcherThread * thread = (*createDispatcherThread)(this); if (! _affinityCores.empty()) { size_t c = _affinityCores[_affinityPos]; LOG_DEBUG("using core %d for standard dispatcher thread", (int) c); thread->setProcessorAffinity(c); ++_affinityPos; if (_affinityPos >= _affinityCores.size()) { _affinityPos = 0; } } { MUTEX_LOCKER(_threadsLock); if (! notEnoughThreads()) { delete thread; return; } _startedThreads.insert(thread); ++_nrRunning; } bool ok = thread->start(); if (! ok) { LOG_FATAL_AND_EXIT("cannot start dispatcher thread"); } else { _lastChanged = TRI_microtime(); } deleteOldThreads(); }