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

timer_queue的疑问 #14

Open
Linkvvu opened this issue Sep 25, 2023 · 1 comment
Open

timer_queue的疑问 #14

Linkvvu opened this issue Sep 25, 2023 · 1 comment

Comments

@Linkvvu
Copy link

Linkvvu commented Sep 25, 2023

当有定时器超时时,难道不需要read(timerfd)吗?代码中是直接调用了定时器绑定的callback,这样不会导致定时器可读事件一直发生吗

@zac-zk
Copy link

zac-zk commented Jul 2, 2024

我测试了一下,定时器并不会一直触发。在timerqueue_cb中会通过get_timo获取超时定时器对应的timer_event,在get_timo中最后会重置定时器的超时时间,epoll监听的始终是最近的事件,这样即使不read也不会一直触发。
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants