Multithread

I’m developing a game library, and I’d like to do an SDL driver for it.
I encounter problems because i spawn two pthread, one for gfx stuff and
SDL_Flip(), the other for waiting events and serving them, but then
everything crashes. Is SDL thread safe under linux?

Ciao,
Giulio

I’m developing a game library, and I’d like to do an SDL driver for it.
I encounter problems because i spawn two pthread, one for gfx stuff and
SDL_Flip(), the other for waiting events and serving them, but then
everything crashes. Is SDL thread safe under linux?

SDL itself is mostly thread-safe, although if you want to handle graphics
and events in a separate thread, you’ll need to pass the SDL_INIT_EVENTTHREAD
flag to SDL_Init(). Note that this flag is EXPLICITLY non-portable, and only
works on BeOS and Linux.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

SDL itself is mostly thread-safe, although if you want to handle graphics
and events in a separate thread, you’ll need to pass the SDL_INIT_EVENTTHREAD
flag to SDL_Init(). Note that this flag is EXPLICITLY non-portable, and only
works on BeOS and Linux.

What does EXPLICITLY mean? That it will never be supported by Win and
others?Anyway, it’s good enough for me…:wink:

Ciao,
Giulio

SDL itself is mostly thread-safe, although if you want to handle graphics
and events in a separate thread, you’ll need to pass the SDL_INIT_EVENTTHREAD
flag to SDL_Init(). Note that this flag is EXPLICITLY non-portable, and only
works on BeOS and Linux.

What does EXPLICITLY mean? That it will never be supported by Win and
others?

Yep. :slight_smile:

Anyway, it’s good enough for me…:wink:

Good enough.
-Sam Lantinga, Lead Programmer, Loki Entertainment Software