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 757 - Child thread wait for events stops main thread
Summary: Child thread wait for events stops main thread
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-24 06:22 UTC by Ron Howe
Modified: 2009-06-30 22:08 UTC (History)
0 users

See Also:


Attachments
Program is minimal main display thread and child event thread (3.78 KB, text/x-c++src)
2009-06-24 06:22 UTC, Ron Howe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Howe 2009-06-24 06:22:00 UTC
Created attachment 334 [details]
Program is minimal main display thread and child event thread

The program can be compiled with libsdl 1.2.0 or 1.3.0

With libsdl 1.2.0 Bug 640 is evident

With libsdl 1.3.0 Bug 640 is fixed but the main thread
hangs when the child eventThread is waiting for events

The program simulates a webcam viewer (was cut down from luvcview)

Main thread runs a loop continuously displaying a changing SDL_YUVOverlay onto a 480x672 frame.

Child thread runs a loop using SDL_PollEvent to handle keyboard and mouse (movement and button) events, allowing quitting

Main thread hangs unless mouse moved, or button or key pressed

This problem can sometimes be avoided by moving the event polling and handling into the main thread's display loop.
Comment 1 Sam Lantinga 2009-06-30 22:08:35 UTC
SDL_PollEvent() and SDL_WaitEvent() can only be called from the thread that initialized the video subsystem.  Other threads should be using SDL_PeepEvents() (which doesn't process events, just returns any that were previously queued)