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
控帧改为等待信号实现 #7
Comments
考察后发现问题的关键在于精准控帧,只要能实现,用信号还是 sleep 都可以。 |
写了个 demo,验证 windows 下的 WaitableTimer 和 结论: 既然 WaitableTimer 的时间粒度达不到要求,不如优先考虑跨平台的 STL sleep_for + 自旋锁。不过自旋的时间应尽可能短。 |
【版本】
0.9.0 (commit 40ef548)
【问题描述】
rgm::base::timer.tick
函数,使用死循环控帧。此实现会使 CPU 持续空跑,浪费 CPU 资源。【期望】
实现改为操作系统的信号机制,例如 Windows 上的
WaitableTimer
系列。优先考虑跨平台实现,如果没有方便的跨平台库,则分别为 Windows 与 UNIX 写实现。The text was updated successfully, but these errors were encountered: