[SDL] SDL_PollEvent VS SDL_WaitEvent

Pete Elmore pete at petta-tech.com
Thu Jan 27 19:51:40 PST 2005

SDL_PollEvent is non-blocking, so you usually put that in your main loop 
to handle user input, if there's a possibility that there is none.  You 
would use this in a single-threaded program.  ("Press any key to stop 
this cool animation.")

SDL_WaitEvent blocks; it doesn't return until there is an event.  So a 
call to it will cause your program to wait if the user hasn't pressed 
any keys or moved the mouse or anything.  ("Press any key to continue.")

Will Childman wrote:
> This quesiton may sound silly : 
> what is the difference between SDL_PollEvent and SDL_WaitEvent? 
> When do I use SDL_PollEvent and when do I use SDL_WaitEvent? 
> Is there an efficiency issue here? 
> Thanks!
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl

More information about the SDL mailing list