We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4750 - SDL_WaitEvent() randomly stalls with events pending (2.0.10 regression)
Summary: SDL_WaitEvent() randomly stalls with events pending (2.0.10 regression)
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.10
Hardware: x86_64 Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.10
Depends on:
Blocks:
 
Reported: 2019-08-02 19:44 UTC by Andrew Church
Modified: 2019-08-06 06:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Church 2019-08-02 19:44:46 UTC
In SDL 2.0.10, SDL_WaitEvent() can stall for a short but noticeable period of time (200-300ms?) even while events are pending.  I observed this as seeing joystick input seem to drop out once every few seconds using a udev-based controller (specifically a Sony DualShock 3).

This does not occur in SDL 2.0.9.

Sample code (spin an analog stick and watch for the event counter to pause):
-----------------------------------------------------
#include <assert.h>
#include <stdio.h>
#include <SDL2/SDL.h>
int main(void)
{
    int counter = 0;
    SDL_Init(SDL_INIT_EVERYTHING);
    assert(SDL_NumJoysticks() >= 1);
    SDL_Joystick *js = SDL_JoystickOpen(0);
    assert(js);
    for (;;) {
        SDL_Event event;
        SDL_WaitEvent(&event);
        printf("event %d\n", counter++);
    }
}
-----------------------------------------------------
Comment 1 Sam Lantinga 2019-08-06 06:49:45 UTC
Ryan, can you look at this ASAP?