Ejemplo n.º 1
0
	void start(int timer_id, unsigned int new_timeout, bool repeat)
	{
		MutexSection mutex_lock(&mutex);

		Timer_Object &object = get_timer_object(timer_id);
		object.stopped = false;
		object.end_time = System::get_time() + new_timeout;
		object.timeout = new_timeout;
		object.repeating = repeat;

		if ( (timeout == -1) || (new_timeout < ( (unsigned int) timeout) ) )
		{
			// Only break into the thread when a shorter timeout is required
			update_event.set();
		}
	}
Ejemplo n.º 2
0
	void stop(int timer_id)
	{
		MutexSection mutex_lock(&mutex);
		Timer_Object &object = get_timer_object(timer_id);
		object.stopped = true;
	}
Ejemplo n.º 3
0
	std::function<void()> &get_func_expired(int timer_id)
	{
		MutexSection mutex_lock(&mutex);
		return get_timer_object(timer_id).func_expired;
	}
Ejemplo n.º 4
0
	Callback_v0 &get_func_expired(int timer_id)
	{
		MutexSection mutex_lock(&mutex);
		return get_timer_object(timer_id).func_expired;
	}