[SDL] SDL thread problem
Edward Byard
e_byard at yahoo.co.uk
Wed May 23 07:04:27 PDT 2007
Stupid me.
That's what you get when you're used to embedded systems (no OS) and just expect a thread to run in the background until you stop it (read: an interrupt function).
So I need to have a loop in my thread, I guess....and just do stuff in there until it needs to quit.
Thanks
Ed
----- Original Message ----
From: David Olofson <david at olofson.net>
To: A list for developers using the SDL library. (includes SDL-announce) <sdl at lists.libsdl.org>
Sent: Wednesday, 23 May, 2007 2:30:45 PM
Subject: Re: [SDL] SDL thread problem
On Wednesday 23 May 2007, Edward Byard wrote:
> Hi Folks
>
> Got a strange problem using threads under SDL...
>
> Basically, once I create the thread, the thread-function gets called
> once (on creation) and never again.
Why, yes...? That's how it's supposed to work. :-) The thread is
created and scheduled to run, and then control returns to the main
thread *at the same time* (literally, if you're on a
multicore/multiprocessor machine) as the thread function is executed.
The thread ends when the thread function returns. (It's possible to
kill threads from the outside too, but doing so is asking for
trouble. Tell the threads to stop and let them clean up and
end "naturally" whenever possible.)
BTW, this is not really SDL specific. This is pretty much how threads
work, regardless of platforms and APIs.
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
___________________________________________________________
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070523/617a8ab3/attachment.htm
More information about the SDL
mailing list