# SDL Digest, Vol 49, Issue 83

**URL:** <https://discourse.libsdl.org/t/sdl-digest-vol-49-issue-83/17881>\
**Category:** SDL Development\
**Created:** [January 19, 2011, 9:26pm UTC](https://discourse.libsdl.org/t/sdl-digest-vol-49-issue-83/17881 "2011-01-19T21:26:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jared\_Maddox](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@Jared\_Maddox](https://discourse.libsdl.org/u/Jared_Maddox)\
**Post date:** [January 19, 2011, 9:26pm UTC](https://discourse.libsdl.org/t/sdl-digest-vol-49-issue-83/17881/1 "2011-01-19T21:26:20Z")

</div>

> Message-ID:  
> ? ? ? ?\<AANLkTimOeSGNTGYejHvweMgXdSaLuG8K\_MAJ=OHPFO=9 at [mail.gmail.com](http://mail.gmail.com)\>  
> Content-Type: text/plain; charset=UTF-8
> 
> Ah, wait a second, since SDL\_SetVideoMode() appears removed in 1.3. I  
> guess it was correct to have pump events in the thread that runs the  
> OpenGL window since that thread had brought up its own window (which  
> is a kind of ‘video mode’) and then got the context for OpenGL from  
> the thread that run SDL init (which had released it with a  
> SDL\_GL\_MakeCurrent(window, NULL);).
> 
> Which means some of the advice in the mailing list is incorrect,  
> implying pump events must be done on the main SDL thread.  
> Actually, no. The mailing list is recommending behavior that will  
> avoid full rewrites of your source code if you try to compile it for  
> another platform. In specific, the Mac platform (and probably the  
> IPhone platform) require all I/O operations (apparently even file  
> I/O!) to be done in the initial thread. As far as I’ve heard, there  
> isn’t any platform that requires I/O to be done outside of the main  
> thread, so I’d suggest that at least for graphics, you stick to the  
> mailing list’s advice.\> Date: Wed, 19 Jan 2011 20:10:37 +0200  
> From: Michael Menegakis   
> To: SDL Development List   
> Subject: Re: [SDL] peeping events from a new thread

---

<div class="post-metadata">

**Author:** ![Rene\_Dudfield](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rene_dudfield/32/3235_2.png) [@Rene\_Dudfield](https://discourse.libsdl.org/u/Rene_Dudfield)\
**Post date:** [January 20, 2011, 6:06pm UTC](https://discourse.libsdl.org/t/sdl-digest-vol-49-issue-83/17881/2 "2011-01-20T18:06:30Z")

</div>

Hi,

you can’t really do graphics in multiple threads on all platforms…  
especially with SDL. So stick with doing ‘pure’ functions in threads 🙂

However OSX can do GL in multiple threads.

[http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl\_threading/opengl\_threading.html](http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_threading/opengl_threading.html)

I’ve done it, and it works.

I’ve also done image loading with multiple threads on OSX with no problems.

… again. Keep all non-software video output, and event stuff in the main  
thread. If you’re just using software surfaces you can do things to them in  
other threads and then blit them finally in the main thread.

cya!On Wed, Jan 19, 2011 at 9:26 PM, Jared Maddox wrote:

> > Date: Wed, 19 Jan 2011 20:10:37 +0200  
> > From: Michael Menegakis   
> > To: SDL Development List   
> > Subject: Re: [SDL] peeping events from a new thread  
> > Message-ID:  
> > \<AANLkTimOeSGNTGYejHvweMgXdSaLuG8K\_MAJ=OHPFO=9 at [mail.gmail.com](http://mail.gmail.com)\>  
> > Content-Type: text/plain; charset=UTF-8
> > 
> > Ah, wait a second, since SDL\_SetVideoMode() appears removed in 1.3. I  
> > guess it was correct to have pump events in the thread that runs the  
> > OpenGL window since that thread had brought up its own window (which  
> > is a kind of ‘video mode’) and then got the context for OpenGL from  
> > the thread that run SDL init (which had released it with a  
> > SDL\_GL\_MakeCurrent(window, NULL);).
> > 
> > Which means some of the advice in the mailing list is incorrect,  
> > implying pump events must be done on the main SDL thread.  
> > Actually, no. The mailing list is recommending behavior that will  
> > avoid full rewrites of your source code if you try to compile it for  
> > another platform. In specific, the Mac platform (and probably the  
> > IPhone platform) require all I/O operations (apparently even file  
> > I/O!) to be done in the initial thread. As far as I’ve heard, there  
> > isn’t any platform that requires I/O to be done outside of the main  
> > thread, so I’d suggest that at least for graphics, you stick to the  
> > mailing list’s advice.
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
