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

bug: Timer callbacks may still be invoked even after the timer has been canceled #668

Open
jdx2013519 opened this issue Mar 15, 2023 · 1 comment

Comments

@jdx2013519
Copy link

jdx2013519 commented Mar 15, 2023

 callingExpiredTimers_ = true;
 cancelingTimers_.clear();
  for (const Entry& it : expired)
  {
    it.second->run();
  }
  callingExpiredTimers_ = false;

if you cancel the timer in callback, the next timer will still run. so you should try to judge timer if it is in cancelingTimers_ beforn callback

 callingExpiredTimers_ = true;
 cancelingTimers_.clear();
  for (const Entry& it : expired)
  {
// if it is in cancelingtimers
    it.second->run();
  }
  callingExpiredTimers_ = false;
@chenshuo
Copy link
Owner

Yes, PRs are welcome.

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