Exemple #1
0
		static inline void itask() {
			++intr_count_;
			task_();
			// IR 関係フラグは必ず mov 命令で・・
			volatile uint8_t r = ADICSR();
			ADICSR = 0x00;
		}
Exemple #2
0
int CB::handle_timeout (const ACE_Time_Value &tv, const void *arg)
{
	int nRet = task_(tv);
	if(nRet == -1)
		return -1;
	return 0;
}
Exemple #3
0
bool AsyncResult::execute()
{
    bool should_call = false;
    {
        Lock::scoped_lock locker(lock_);
        if (status_ == WAIT) {
            should_call = true;
            status_ = RUNNING;
        }
    }
    if (should_call) {
        try {
            task_(*this);
            set_success();
        } catch (AvalonException& err) {
            set_error(&err);
        } catch (boost::thread_interrupted) {
            set_interrupt();
            throw;
        } catch (...) {
            set_error();
        }
    }
    return should_call;
}
Exemple #4
0
void PeriodicTask::do_work() {
  while (!canceled_.load()) {
    std::unique_lock<std::mutex> lock(cv_m_);
    if (!cv_.wait_for(lock, period_, [this]() { return canceled_.load(); })) {
      task_();
    }
  }
}
Exemple #5
0
		//-----------------------------------------------------------------//
		void sync() const noexcept
		{
			if(level_ > 0) {
				volatile uint32_t cnt = counter_;
				while(cnt == counter_) sleep_();
			} else {
				auto ref = CMT::CMCNT();
				while(ref <= CMT::CMCNT()) sleep_();
				task_();
				++counter_;
			}
		}
Exemple #6
0
void TaskImpl::run()
{
    task_();
}
Exemple #7
0
 void run_impl() {
     task_();
 }