Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout > 524 is not accurate #901

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,19 @@ static int __dpvs_timer_sched(struct timer_scheduler *sched,
timer->delay = 1;
}

/* add to corresponding wheel, from higher level to lower. */
for (level = LEVEL_DEPTH - 1; level >= 0; level--) {
/* MUST add lower level passed time to delay */
/* add to corresponding wheel, from lower level to higher. */
for (level = 0; level < LEVEL_DEPTH; level++) {
off = timer->delay / get_level_ticks(level);
if (off > 0) {
if (off < LEVEL_SIZE) {
hash = (sched->cursors[level] + off) % LEVEL_SIZE;
list_add_tail(&timer->list, &sched->hashs[level][hash]);
#ifdef CONFIG_TIMER_DEBUG
assert(timer->handler == handler);
#endif
return EDPVS_OK;
} else {
timer->delay += sched->cursors[level] * get_level_ticks(level);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timer->delay is an user-specified parameter, and we should not changed. It seems a carry-in problem. You may fix it in some other way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timer->delay is an user-specified parameter, and we should not changed. It seems a carry-in problem. You may fix it in some other way.

seems #29 fixed, but not merged

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will reconsider it later.

}
}

Expand Down
Loading