Esempio n. 1
0
void Function::preRun(MasterTimer* timer)
{
    Q_UNUSED(timer);

    qDebug() << "Function preRun. ID: " << m_id;
    m_stop = false;
    m_running = true;

    emit running(m_id);
}
Esempio n. 2
0
/*
 * External constructor
 */
CThreadAnimation *CThreadAnimation::create(const STRING file, const int x, const int y, const int width, const int height, const bool bPersist)
{
	if (!file.empty() && !running(file, x, y))
	{
		CThreadAnimation *p = new CThreadAnimation(file, x, y, bPersist);
		p->m_pAnm->resize(width, height);
		m_threads.insert(p);
		return p;
	}
}
Esempio n. 3
0
void KWin::Script::run()
{
    if (running() || m_starting) {
        return;
    }
    m_starting = true;
    QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this);
    connect(watcher, SIGNAL(finished()), SLOT(slotScriptLoadedFromFile()));
    watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile));
}
	bool ProcessInterfaceTemplate::stopping()
	{
		string answer;
		OMethodStringStream running("stopping");

		answer= sendMethod(m_sSendTo, running, true);
		if(answer == "true")
			return true;
		return false;
	}
Esempio n. 5
0
void PerformanceTimer::stop()   
{
   BOOST_ASSERT(running());
   
   // if there is an existing step pending then record its duration
   recordPendingStep();
   
   // reset start time
   startTime_ = ptime(not_a_date_time);
}
Esempio n. 6
0
void ScanStatus::
stop()
{
	status = 1;
	if( running() ) {
		if( gui ) gui->set_done(1);
		cancel();
		join();
	}
}
Esempio n. 7
0
void Timer::Stop() {
  if (running()) {
    if (Caffe::mode() == Caffe::GPU) {
      CUDA_CHECK(cudaEventRecord(stop_gpu_, 0));
      CUDA_CHECK(cudaEventSynchronize(stop_gpu_));
    } else {
      stop_cpu_ = boost::posix_time::microsec_clock::local_time();
    }
    running_ = false;
  }
}
Esempio n. 8
0
void Timer::Start() {
  if (!running()) {
    if (Caffe::mode() == Caffe::GPU) {
      CUDA_CHECK(cudaEventRecord(start_gpu_, 0));
    } else {
      start_cpu_ = boost::posix_time::microsec_clock::local_time();
    }
    running_ = true;
    has_run_at_least_once_ = true;
  }
}
Esempio n. 9
0
void PerformanceTimer::advance(const std::string& step)
{
   BOOST_ASSERT(running());
   
   // if there is an existing step pending then record its duration
   recordPendingStep();
   
   // record the start time and add a step
   startTime_ = now();
   steps_.push_back(std::make_pair(step, time_duration()));
}
Esempio n. 10
0
void Clock::run() {
    for (;;) {
        if (running()) {
            std::this_thread::sleep_for(period);
            clk.get()->notify_all();
        }
        else {
            break;
        }
    }
}
Esempio n. 11
0
//--------------------------------------------------------------
void Tween::reset(int a_millis) {
	if (!_isComplete) {
		*_propAdd = _begin;
		
		_startTime = a_millis;
		_time = 0.f;
		
		_isComplete = false;
	}
	cout << "Tween :: reset : running: " << running() << " complete: " << complete() << endl;
}
ColorThread::~ColorThread()
{
	if(running())
	{
		window->set_done(0);
		completion->lock("ColorThread::~ColorThread");
		completion->unlock();
	}
	delete mutex;
	delete completion;
}
Esempio n. 13
0
void CompassCalibrator::start(bool retry, float delay, uint16_t offset_max) {
    if(running()) {
        return;
    }
    _offset_max = offset_max;
    _attempt = 1;
    _retry = retry;
    _delay_start_sec = delay;
    _start_time_ms = AP_HAL::millis();
    set_status(COMPASS_CAL_WAITING_TO_START);
}
Esempio n. 14
0
void PerformanceTimer::start(const std::string& step)   
{
   BOOST_ASSERT(!running());
   
   // reset state
   startTime_ = now();
   steps_.clear();
   
   // advance to step
   advance(step);
}
Esempio n. 15
0
    void singlethreaded::execute_async(unsigned niter) 
    {
      PyEval_InitThreads();
      assert(PyEval_ThreadsInitialized());

      boost::mutex::scoped_lock l(iface_mtx);
      // compute_stack(); //FIXME hack for python based tendrils.
      scoped_ptr<thread> tmp(new thread(bind(&singlethreaded::execute_impl, this, niter)));
      tmp->swap(runthread);
      while(!running()) usleep(5); //TODO FIXME condition variable?
    }
Esempio n. 16
0
float CPUTimer::MicroSeconds() {
  if (!has_run_at_least_once()) {
    LOG(WARNING) << "Timer has never been run before reading time.";
    return 0;
  }
  if (running()) {
    Stop();
  }
  this->elapsed_microseconds_ = (this->stop_cpu_ -
                                this->start_cpu_).total_microseconds();
  return this->elapsed_microseconds_;
}
Esempio n. 17
0
edthreaded_fd::~edthreaded_fd()
{
	if (running())
		stop();
	pthread_join(m_thread, nullptr);
	pthread_mutex_destroy(&m_send_lock);
	pthread_mutex_destroy(&m_recv_lock);
	pthread_mutex_destroy(&m_error_lock);
	pthread_mutex_destroy(&m_running_lock);
	delete m_wait_timer;
	close(m_fd);
}
Esempio n. 18
0
bool edthreaded_fd::set_fd(int32_t fd_)
{
	if (running())
	{
		_setError(AlreadyRunning, 0);
		return false;
	}
	if (m_fd != -1)
		close(m_fd);
	m_fd = fd_;
	return true;
}
Esempio n. 19
0
void PID::start(Callback *c, unsigned r, const ControlParams *p, Thread::Priority prio)
{
  if (!c) return;
  if (running()) stop();
  if (r) setRate(r);
  if (p) setControlParams(*p);
  mut.lock();
  cb = c;
  pleaseStop = false;
  mut.unlock();
  Thread::start(prio);
}
Esempio n. 20
0
void SkimDbThread::
stop()
{
	if( running() ) {
		done = 1;
		input_lock->unlock();
		cancel();
		join();
	}
	if( commercials && !commercials->remove_user() )
		commercials = 0;
}
Esempio n. 21
0
truefalse CRunner::post_dist_task(CMB * mb)
{
  C_ASSERT_RETURN(mb, "\n", C_BAD);

  if (unlikely(!running()))
  {
    mb->release();
    return C_BAD;
  }

  return c_tools_mb_putq(m_ping_container->task(), mb, "post dist task");
}
TBool CAiwPrintingProvider::IsImagePrintUiRunning()
    {
    TFindThread findt(KImagePrintUiSearchPatternBySID);
    TFullName result;
    TBool running(EFalse);
    if (!findt.Next(result))
        {
        FTRACE(FPrint(_L("[CAiwPrintingProvider] Thread '%S'is found"), &result));
        running = ETrue;
        }
     return running;
    }
Esempio n. 23
0
void RandomPlot::stop()
{
    Q_EMIT elapsed( d_timeStamp.elapsed() );

    if ( d_timer )
    {
        d_timer->stop();
        Q_EMIT running(false);
    }

    canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, true);
}
void SatelliteModel::setSingleRequest(bool single)
{
    if (running()) {
        qWarning() << "Cannot change single request mode while running";
        return;
    }

    if (single != isSingle) { //flag changed
        isSingle = single;
        emit singleRequestChanged();
    }
}
Esempio n. 25
0
int main(int argc, char* argv[])
{
    
    server_init();
    
    server_set_opt(SERVER_PORT, (void *)1234);
    server_set_opt(READ_TIMEOUT, (void *)180);
    server_set_opt(MAX_READ_SIZE, (void *)4096);

    running(); 
    return 0;
}
Esempio n. 26
0
PIDFCParams PIDFlowController::getParams() const
{
  PIDFCParams ret;
  mut.lock();
  if (!running()) { // make sure to physically read hardware if PID loop is not running
    ReadVFunctor f(const_cast<PIDFlowController *>(this));
    Thread::doFuncInRT(f); // need to call readVFunctor in RT since we are in linux context here and we will be using doubles which use FPU regs
  }
  ret = params;
  mut.unlock();
  return ret;
}
Esempio n. 27
0
 bool poll()
 {
     if (stopped||!running()) {
         PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopping");
         if (server) {
             server->stop();
             server.clear();
         }
         return false;
     }
     return true;
 }
Esempio n. 28
0
dialogKopiuj::dialogKopiuj(QWidget *parent, QList<File> *fileList, QString sdk, int mode, QString sourcePath, QString targetPath) :
        QDialog(parent),
        ui(new Ui::dialogKopiuj)
{
    ui->setupUi(this);
    this->setFixedSize(this->width(),this->height());
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    this->sourcePath = sourcePath;
    this->targetPath = targetPath;
    this->mode = mode;

    this->filesCopiedSize = 0;

    if (this->sourcePath.at(this->sourcePath.length() - 1) != '/')
        this->sourcePath.append("/");
    if (this->targetPath.at(this->targetPath.length() - 1) != '/')
        this->targetPath.append("/");

    this->opFinished = false;
    int max = 0;
    for (int i=0; i < fileList->size(); i++)
    {
        max += fileList->at(i).fileSize.toInt();
    }
    this->ui->progressTotal->setMaximum(max);

    this->remains = fileList->size() + 1;

    this->threadProgress = new ThreadProgress;
    this->threadProgress->sdk = sdk;
    this->threadProgress->mode = mode;

    this->threadCopy = new ThreadCopy;
    this->threadCopy->sdk = sdk;
    this->threadCopy->mode = mode;
    this->threadCopy->sourcePath = this->sourcePath;
    this->threadCopy->targetPath = this->targetPath;
    this->threadCopy->fileList = fileList;
    this->threadCopy->start();

    connect(this->threadCopy, SIGNAL(nextFile(QString, QString, QString, int, int)), this, SLOT(nextFile(QString, QString, QString, int, int)));
    connect(this->threadCopy, SIGNAL(copied()), this, SLOT(copied()));
    connect(this->threadCopy, SIGNAL(isRunning()), this, SLOT(running()));
    connect(this->ui->buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
    //my new OK button
    connect(this->ui->buttonCopyOK, SIGNAL(clicked()), this, SLOT(close()));
//    connect(this->threadProgress, SIGNAL(progressValue(int)), this->ui->progressFile, SLOT(setValue(int)));
    connect(this->threadProgress, SIGNAL(progressValue(int)), this, SLOT(setProgressValue(int)));

    this->setFixedHeight(180);
    this->setLayout(ui->gridLayout);
}
Esempio n. 29
0
void Visualizer::lightchange(){
        // Default is always clear as uses the Fill command
        int r=255,g=0,b=0;
        int animationColorStatus=0;
        while(running())
        {
                usleep(1000 * 1);
                //Get nice Rainbow Colors
                switch(animationColorStatus) {
                case 0:
                        b++; canvas()->Fill(r,g,b);
                        if(b >= 255) {
                                animationColorStatus++;
                        }
                        break;
                case 1:
                        r--; canvas()->Fill(r,g,b);
                        if(r <= 0) {
                                animationColorStatus++;
                        }
                        break;
                case 2:
                        g++; canvas()->Fill(r,g,b);
                        if(g >= 255) {
                                animationColorStatus++;
                        }
                        break;
                case 3:
                        b--; canvas()->Fill(r,g,b);
                        if(b <= 0) {
                                animationColorStatus++;
                        }
                        break;
                case 4:
                        r++; canvas()->Fill(r,g,b);
                        if(r >= 255) {
                                animationColorStatus++;
                        }
                        break;
                case 5:
                        g--; canvas()->Fill(r,g,b);
                        if(g <= 0) {
                                animationColorStatus = 0;
                        }
                        break;
                }

        }

        canvas()->Clear();

}
Esempio n. 30
0
void eventLoop(QApplication& a, Engine& engine) {
    QEventLoop loop;

    while(running()) {
        a.sendPostedEvents();
        loop.processEvents(QEventLoop::WaitForMoreEvents);
        while (engine.isRunnable()) {
            engine.interpret();
            a.sendPostedEvents();
            loop.processEvents(QEventLoop::AllEvents);
        }
    }
}