示例#1
0
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;
}
示例#3
0
文件: mysql.cpp 项目: bonnedav/anope
	~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;
	}
示例#4
0
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;
}
示例#5
0
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;
}
示例#6
0
文件: mysql.cpp 项目: bonnedav/anope
	ModuleSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR)
	{
		me = this;


		DThread = new DispatcherThread();
		DThread->Start();
	}
示例#7
0
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();
}