There had been a thread on that topic (and maybe more).
The conclusion was, in any case, if you can manage to avoid using threads, do it.
The main reason is that not all the OS will react the same way, depending on their
policy to switch between various tasks. Even if you clearly separate the display zones as disjoint areas, you may encounter troubles, especially if each thread does its own refresh ! Imagine there is a context switch while a refresh is performed, you might get stange glitches or something like that.
You have, at least, to synchronize the threads so that each update gets performed fully.
Correct me if I’m wrong.
Regards,
Julien
— En date de?: Mar 9.6.09, shree 0987 a ?crit? shree 0987
Objet: [SDL] Two threads updating screen
?: “sdl at lists.libsdl.org”
Date: Mardi 9 Juin 2009, 15h16
Hello,
?
I have two threads updating?the screen. One is a UI thread, which puts a few buttons on the bottom of the screen and handles user input. The other is a graphics/video thread which updates the top?90% of the screen at 33ms intervals.
?
Is there a standard way of handling SDL_Flip or SDL_Updaterect in this case? I see the FAQ at http://www.libsdl.org/faq.php?action=listentries&category=2?says SDL video functions should be called only from the main thread.
?
Thanks,
–Shree.
-----La pi?ce jointe associ?e suit-----
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org