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 13

Summary: event thread tweaks...
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: All   
OS: All   

Description Ryan C. Gordon 2006-01-03 11:56:31 UTC
From: "Marc A. Pelletier" <marc@abovesecurity.com>
To: sdl@libsdl.org
Date: Tue, 13 Sep 2005 10:19:50 -0400
Subject: [SDL] Some multithreaded improvement to the event queue...

Hello all.

I did a small improvement run on SDL_events.c to stratch an itch of mine that
results in the following features:

- SDL_WaitEvent() is now properly blocks the calling thread when there are no
pending events (and wakes it up immediately when events arrive rather than
miss them by up to 10ms because of the SDL_Delay)

- If the event queue gets full, the thread that is adding the events will be
blocked until room becomes available rather than just drop them on the floor.

Both features are only enabled when SDL_INIT_EVENTTHREAD is given to
SDL_Init() and the event thread was created successfuly.  They don't make
sense if you don't have a separate event collection thread anyways.

I've only tested this under Linux, but I use no machine dependent code so
it /should/ work on any platform where threads work correctly.

The included diff was made against 1.2.9.

-- Marc A. Pelletier
Comment 1 Ryan C. Gordon 2006-01-03 11:56:59 UTC
(I believe there was some resistance to this patch...check the mailing list archives!)

--ryan.

Comment 2 Ryan C. Gordon 2006-01-27 11:23:02 UTC
Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL.

--ryan.