Ejemplo n.º 1
0
static void 
timer_update(struct timer *T) {
	// try to dispatch timeout 0 (rare condition)
	timer_execute(T);

	// shift time first, and then dispatch timer message
	timer_shift(T);

	timer_execute(T);

}
Ejemplo n.º 2
0
static void timer_update_tick(struct timer *T) {
	LOCK(T);

	// try to dispatch timeout 0 (rare condition)
	timer_execute(T);

	// shift time first, and then dispatch timer message
	timer_shift(T);

    //check agin
	timer_execute(T);

	UNLOCK(T);
}
Ejemplo n.º 3
0
static void 
timer_update(struct timer *T)
{
	while (__sync_lock_test_and_set(&T->lock,1)) {};

	// try to dispatch timeout 0 (rare condition)
	timer_execute(T);

	// shift time first, and then dispatch timer message
	timer_shift(T);
	timer_execute(T);

	__sync_lock_release(&T->lock);
}
Ejemplo n.º 4
0
/* 更新当前时间并分发所有已经到期的定时事件. 此函数是线程安全的. */
static void 
timer_update(struct timer *T) {
	SPIN_LOCK(T);

	/* 第一件做的事情是分发当前时间未更新的情况下到期的定时事件, 这些事件
	   是在上次分发运行中添加进来而未检查到的. 如果不这样做, 它们将永远丢失. */
	// try to dispatch timeout 0 (rare condition)
	timer_execute(T);

	/* 然后才是更新当前时间, 重新安排层级列表集中的定时触发事件, 并分发此时到期的定时事件 */
	// shift time first, and then dispatch timer message
	timer_shift(T);

	timer_execute(T);

	SPIN_UNLOCK(T);
}
Ejemplo n.º 5
0
static void timer_tick(struct core_timer* timer, struct core_poller* io)
{
	timer_execute(timer,io);
	timer_shift(timer);
	timer_execute(timer, io);
}