Re: [sdljava-users] EventManager: using pollEvent() instead of waitEvent() ?
Status: Beta
Brought to you by:
ivan_ganza
From: Patric R. <pa...@ma...> - 2005-10-16 21:16:38
|
It isn't a real problem. SDL_WaitEvent() has to use a loop, too. As you can see in the source: int SDL_WaitEvent (SDL_Event *event) { while ( 1 ) { SDL_PumpEvents(); switch(SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS)) { case -1: return 0; case 1: return 1; case 0: SDL_Delay(10); } } } I think, it would be best to maintain the original timings and sleep for 10 ms. Patric Ivan Z. Ganza schrieb: > Yes it sounds like pollEvent() would be better here. The only problem > is that it will eat much or all of the CPU in the loop unless we sleep > some between calls. Perhaps a configurable param? > > -Ivan/ > > Patric Rufflar wrote: > > >>Hello List, >> >>I am currently having problems stopping the EventManager thread in >>some cases. It seems that the native call to waitEvent() cannot be >>interrupted by calling interrupt() of the thread. >> >>I think using pollEvent() would be better here (because it is already >>an own thread) and will fix some problems. >> >>What do you think about it? >> >>Best Regards >>Patric >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: >>Power Architecture Resource Center: Free content, downloads, discussions, >>and more. http://solutions.newsforge.com/ibmarch.tmpl >>_______________________________________________ >>sdljava-users mailing list >>sdl...@li... >>https://lists.sourceforge.net/lists/listinfo/sdljava-users > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users > > |