Exemple #1
0
void iv_main(void)
{
	struct iv_state *st = iv_get_state();
	int run_timers;

	st->quit = 0;

	run_timers = 1;
	while (1) {
		struct timespec _abs;
		const struct timespec *abs;

		if (run_timers)
			iv_run_timers(st);
		iv_run_tasks(st);

		if (st->quit || !st->numobjs)
			break;

		if (iv_pending_tasks(st)) {
			_abs.tv_sec = 0;
			_abs.tv_nsec = 0;
			abs = &_abs;
		} else {
			abs = iv_get_soonest_timeout(st);
		}

		run_timers = iv_fd_poll_and_run(st, abs);
	}
}
Exemple #2
0
void iv_main(void)
{
	struct iv_state *st = iv_get_state();

	st->quit = 0;
	while (1) {
		struct timespec to;

		iv_run_tasks(st);
		iv_run_timers(st);

		if (st->quit || !st->numobjs)
			break;

		if (iv_pending_tasks(st) || iv_get_soonest_timeout(st, &to)) {
			to.tv_sec = 0;
			to.tv_nsec = 0;
		}

		iv_fd_poll_and_run(st, &to);
	}
}