-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
SDL_WaitEvent causes high cpu usage #3976
Comments
@franko : our issue was moved here, might make it easier to provide a PR for the work you did. @slouken : i think @franko made it quite clear that he already invested a lot of work and would like at least a review before continuing with the SDL_WaitEventTimeout() code when there's a good chance it will ultimately be rejected. |
Thank you for you words @rofl0r. Actually I will probably implement the SDL_WaitEventTimeout() code despite the fact that my patch was not reviewed and also that there is a significant chance to be rejected anyway. I know it can be rejected anyway because it is mostly irrelevant for video games and video games are the main use case for SDL. So, when I have time I may implement the SDL_WaitEventTimeout() code. Ultimately, if it is still rejected I will publish it on github as a patch for SDL2 for desktop applications and I will suggest to use it to the package maintainers of my projects. |
I did review your patch, I'm just waiting for you to finish the SDL_WaitEventTimeout() implementation for final review. Has it been tested on macOS yet? |
May be it was not clear but just let me clarify: the current version of the Otherwise, as I said, unfortunately I cannot test on OS X myself and I didn't I will try to implement the new SDL_WaitEventTimeout() variant I just didn't have enough spar time lately and I was hoping to have more feedback and support on the current version of the patch. |
Apologies if this is the wrong place - the migration made things kind of tricky to navigate (though welcome to Github nonetheless 🙂) The current documentation states "SDL_WaitEventTimeout() also returns 0 if it timed out". This means that in order to determine if it timed out or actually errored, I'd have to do something nasty like Could we possibly change it so that it returns -1 upon timing out? Otherwise the usefulness of this function is greatly reduced. |
The PR with the new implementation is there! I have given an implementation of the same approach by including now also a timeout. |
I made a fork of the SDL repository with the fix to reduce CPU uage to zero on SDL_WaitEvent and WaitEventTimeout. The repository is: https://github.com/franko/sdl-4d The tag https://github.com/franko/SDL-4d/releases/tag/release-2.0.14-s4d-2 corresponds to the SDL2 release 2.0.14 including the fix. I made a PR but it was never accepted neither refused: I closed the PR by accident because I deleted the branch but I may re-submit again the patch. |
that could be helpful as most people don't look at closed issues/PRs |
I posted a new PR to replace this one, closed by error: |
great, as #4419 was finally merged this can be closed 🎉 |
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
franko's patch as of 13 jan 2021 (sdl2-blocking-franko.patch, text/plain, 2021-01-13 20:08:02 +0000, 36047 bytes)Patch for blocking wait call version 2 (0001-Implement-blocking-WaitEvent-call.patch, text/plain, 2021-01-15 16:43:23 +0000, 26741 bytes)Patch for blocking wait call version 3 (0001-Implement-blocking-WaitEvent-call.patch, text/plain, 2021-01-17 15:09:39 +0000, 27951 bytes)Additional patch to fix build without threads enabled (0001-Fix-error-with-wake-up-mutex-when-threads-are-disabl.patch, text/plain, 2021-01-18 10:27:49 +0000, 2970 bytes)Patch for blocking wait call version 4 (0001-Implement-blocking-WaitEvent-call.patch, text/plain, 2021-01-23 18:54:25 +0000, 28342 bytes)Reported in version: 2.0.14
Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2021-01-09 18:06:42 +0000, wrote:
On 2021-01-09 19:10:51 +0000, Cameron Gutman wrote:
On 2021-01-09 23:22:18 +0000, wrote:
On 2021-01-10 18:11:27 +0000, wrote:
On 2021-01-11 22:26:38 +0000, Sam Lantinga wrote:
On 2021-01-13 15:04:41 +0000, Francesco Abbate wrote:
On 2021-01-13 20:08:02 +0000, wrote:
On 2021-01-13 20:14:20 +0000, wrote:
On 2021-01-13 22:39:40 +0000, Francesco Abbate wrote:
On 2021-01-15 16:43:23 +0000, Francesco Abbate wrote:
On 2021-01-17 15:09:39 +0000, Francesco Abbate wrote:
On 2021-01-18 10:27:49 +0000, Francesco Abbate wrote:
On 2021-01-21 17:24:49 +0000, wrote:
On 2021-01-21 18:28:09 +0000, Francesco Abbate wrote:
On 2021-01-23 18:54:25 +0000, Francesco Abbate wrote:
On 2021-01-25 13:48:18 +0000, RNMSS wrote:
On 2021-01-25 14:18:46 +0000, Francesco Abbate wrote:
On 2021-01-26 04:18:20 +0000, Sam Lantinga wrote:
On 2021-01-26 17:32:38 +0000, Francesco Abbate wrote:
On 2021-02-04 17:04:46 +0000, wrote:
On 2021-02-04 18:32:55 +0000, Francesco Abbate wrote:
On 2021-02-04 20:08:08 +0000, Sam Lantinga wrote:
The text was updated successfully, but these errors were encountered: