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

关于TimerNode构造函数中可能出现的问题 #131

Open
codersyl opened this issue Dec 16, 2021 · 1 comment
Open

关于TimerNode构造函数中可能出现的问题 #131

codersyl opened this issue Dec 16, 2021 · 1 comment

Comments

@codersyl
Copy link

在WebServer/WebServer/Timer.cpp,第13、14行,TimerNode构造函数中:
expiredTime_ = (((now.tv_sec % 10000) * 1000) + (now.tv_usec / 1000)) + timeout;

其中对now.tv_sec取了10000的模,如果我没理解错的话,在极端情况下,会出现取模后为9999,微秒刚好也是999(或者离1000很近)的情况,此时加上 timeout, expiredTime_ > 10000 * 1000,导致出现一个永远不会过期的TimerNode。请问这种情况存在吗?

@codersyl
Copy link
Author

不好意思写错了,毫秒数为999(或者离1000很近)。而不是微秒

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

1 participant