Fix bug in timer wheel
This commit is contained in:
parent
a01b839b67
commit
6953d03cb3
@ -48,7 +48,7 @@ Timer_Create(uint64_t timeout, TimerCB cb, void *arg)
|
||||
evt->arg = arg;
|
||||
|
||||
Spinlock_Lock(&timerLock);
|
||||
slot = (timerHead + timeout) % TIMER_WHEEL_LENGTH;
|
||||
slot = (timerHead + timeout + TIMER_WHEEL_LENGTH - 1) % TIMER_WHEEL_LENGTH;
|
||||
// XXX: should insert into tail
|
||||
LIST_INSERT_HEAD(&timerSlot[slot], evt, timerQueue);
|
||||
Spinlock_Unlock(&timerLock);
|
||||
|
Loading…
Reference in New Issue
Block a user