コード例 #1
0
ファイル: worker.cpp プロジェクト: strahlex/cnc-machine
void Worker::commandReceived(const QByteArray command)
{
    if (m_currentState == StoppedState)
    {
        return;
    }

    if (command == "ok")
    {
        m_waitingCount--;
        emit currentLineChanged(m_currentLine - m_waitingCount + 1);

        if (m_waitingCount < m_bufferSize)
        {
            if ((m_currentLine < m_commandList.size())
                    && (m_currentState == RunningState)) // a new command needs to be sent
            {
                sendLine();
            }
        }

        if ((m_waitingCount == 0)
                && (m_currentLine == m_commandList.size())) // we have finished
        {
            stopQueue();
            m_currentState = StoppedState;
            emit currentStateChanged(m_currentState);
            emit finished();
        }
    }
}
コード例 #2
0
ファイル: worker.cpp プロジェクト: strahlex/cnc-machine
void Worker::stop()
{
    stopQueue();

    m_currentState = StoppedState;
    emit currentStateChanged(m_currentState);
}
コード例 #3
0
ファイル: buffer.cpp プロジェクト: SiteView/ecc82Server
void ThreadQueue::run(void)
{
	data_t *prev;
	started = true;
	for(;;)
	{
		Semaphore::wait();
		if(!started)
			sleep((timeout_t)~0);
		startQueue();
		while(first)
		{
			runQueue(first->data);
			enterMutex();
			prev = first;
			first = first->next;
			delete[] prev;
			if(!first)
				last = NULL;
			leaveMutex();
			if(first)
				Semaphore::wait(); // demark semaphore
		}
		stopQueue();
	}
}
コード例 #4
0
ファイル: controller.cpp プロジェクト: ribalda/gerbil
Controller::~Controller()
{

	// stop background task queue thread
	stopQueue();
	window->deleteLater();
	delete subs;
}
コード例 #5
0
/**
 * \brief Slot to handle toolbar actions
 *
 * This is just a dispatcher method that calls the appropriate acction 
 * handler slot.
 */
void	TaskMainWindow::handleToolbarAction(QAction *action) {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "toolbar action called");
	if (action == ui->actionStartQueue) {
		startQueue();
		return;
	}
	if (action == ui->actionStopQueue) {
		stopQueue();
		return;
	}
	if (action == ui->actionDelete) {
		deleteSelected();
		return;
	}
	if (action == ui->actionDownload) {
		downloadSelected();
		return;
	}
}
コード例 #6
0
ファイル: SipperProxyQueue.cpp プロジェクト: bklang/sipper
SipperProxyQueue::~SipperProxyQueue()
{
   stopQueue();

   int oldstate;
   pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
   pthread_mutex_lock(&tEventQueueMutex);

   //Queue should be destroyed after all its messages were given out. Since in 
   //dequeue we are leaving out. I removed the check of queuecount != 0 here.
   while (sleepingFeeders || sleepingConsumers || 
          waitingFeeders || waitingConsumers)
   {
      pthread_cond_wait(&waitingConsumerCond, &tEventQueueMutex);
   }

   if(iQueueCount != 0)
   {
   }

   t_EventQueueNodePtr currNode, nextNode;
   currNode = ptFreeList;

   for(unsigned int idx = 0; (idx < highWaterMark) && (currNode != NULL); idx++)
   {
      //NULL check is reqd as not all the nodes were captured back to freelist.
      //Some mem leaks because dequeue returns error even there are messages in 
      //queue to process.
      nextNode = currNode->ptNextNode;
      delete currNode;
      currNode = nextNode;
   }

   pthread_mutex_unlock(&tEventQueueMutex);
   pthread_setcancelstate(oldstate, NULL);

   pthread_mutex_destroy(&tEventQueueMutex);
   pthread_cond_destroy(&waitingFeederCond);
   pthread_cond_destroy(&waitingConsumerCond);

}
コード例 #7
0
CoreBoundTaskQueue::~CoreBoundTaskQueue() {
  if (_thread != NULL) stopQueue();
}
コード例 #8
0
CoreBoundPriorityQueue::~CoreBoundPriorityQueue() {
  if (_thread != nullptr) stopQueue();
}
コード例 #9
0
ファイル: CoreBoundQueue.cpp プロジェクト: JWUST/hyrise
CoreBoundQueue::~CoreBoundQueue() {
  if (_thread != nullptr) stopQueue();
}