[SDL] how to detect if a thread is still running

Neil Bradley nb at synthcom.com
Tue Jul 23 12:57:00 PDT 2002

> > > So what is the correct, platform independent, way to do this?
> > I usually have a global variable and set it when I want the thread to
> quit.

I dearly hope you mean a conditional variable or the like rather than
periodically polling a global for a condition to happen!

> I don't want the thread to quit. It is doing a lengthy calculation for me
> and it quits when it has finished. It would have been easiest for me if
> there were some function int SDL_ThreadStatus (SDLThread *thread) that
> allows me to get the status of the thread without having to add a global
> flag and a mutex to protect that flag.

What sorts of operations are you doing when it's busy vs. when it's not
busy? Depending upon your answer, there may be other ways, but it doesn't
seem like a good idea to check status on something and wait for it to
finish - if indeed that's what you're doing. A conditional variable via
SDL is probably your answer. Let me know what it's doing based upon the
thread's busy/nonbusy status.


Neil Bradley            What are burger lovers saying
Synthcom Systems, Inc.  about the new BK Back Porch Griller?
ICQ #29402898	        "It tastes like it came off the back porch." - Me

More information about the SDL mailing list