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

Summary: SDL_WaitEvent() randomly stalls with events pending (2.0.10 regression)
Product: SDL Reporter: Andrew Church <achurch+sdl>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: sezeroz
Version: 2.0.10Keywords: target-2.0.10
Hardware: x86_64   
OS: Linux   

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?