[SDL] SDL_Quit() and timers...

Sam Lantinga slouken at devolution.com
Wed Aug 8 22:43:00 PDT 2001

> Hey all.

> I'm new around here and to SDL in general, and I have a question about
> what SDL_Quit() does with timers that were set with SDL_AddTimer().
> Namely, I was working on some OpenGL stuff and so I set up a timer to go
> off every 30 milliseconds and it would draw the current frame.  Then, when
> I would quit, SDL_Quit() would run since it was setup to with the atexit()
> command, and the program would often hang and I'd get a Seg Fault (I'm
> developing in Linux if that matters).  I was able to fix it simply by
> calling SDL_RemoveTimer() just before exiting to remove the frame timer
> that I had setup.  It seemed almost as if SDL_Quit() would either
> terminate the program without stopping the timer or the thread that was
> running it, or something else beyond my grasp.

That's very possible.  I haven't looked to see what the timer thread does
when SDL_Quit() is called.

You probably shouldn't draw a from from a timer callback though.  Some
systems simply don't allow it, and the resolution of the timer is only
10 ms, which is less than you might get by some other methods.

Check the archives for discussion about graphic updates and threads.

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

More information about the SDL mailing list