SDL_PeepEvents() and the event thread

I just “discovered” (during a debugging session with a debugger w/o
thread support… aargh!) that SDL_PeepEvents() doesn’t work unless the
event thread is running.

SDL_PollEvent() does work, though. Does that mean that it’s only
SDL_PeepEvents() that needs the event thread - or is this just on my
system? (XFree86/Linux.)

My guess is that SDL_PeepEvents() requires the event thread because there
are no events queued to browse unless “something” - the event thread - is
there to grab them and turn them into SDL events.

However, I just had an idea: Why not poll all event sources for events
inside SDL_PeepEvents(), if the event thread isn’t active? Don’t know how
useful it would be, but there are debuggers without thread support, if
that counts… heh

Is this done on platforms without threads, or do they just not support
SDL_PeepEvents()?

Would this be possible to do on all supported platforms? (It would
require that all event sources can be polled - blocking-only sources
would ruin the whole idea.)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -’

I just “discovered” (during a debugging session with a debugger w/o
thread support… aargh!) that SDL_PeepEvents() doesn’t work unless the
event thread is running.

It does work, you just have to call SDL_PumpEvents(), as documented.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

DOH! blush

However, shouldn’t that be mentioned in conjunction with SDL_PeepEvents()
in the man pages? There’s not even a “see also”…

(And I still think it would be kind of nice if applications could just
use SDL_PeepEvents() without special cases… :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Tuesday 12 March 2002 01:27, Sam Lantinga wrote:

I just “discovered” (during a debugging session with a debugger w/o
thread support… aargh!) that SDL_PeepEvents() doesn’t work unless
the event thread is running.

It does work, you just have to call SDL_PumpEvents(), as documented.