[SDL] OpenGL in threads?

Jan Klesnil klesnil at centrum.cz
Mon Mar 11 17:19:01 PST 2002


Can SDL run with one thread for drawing in OpenGL, one thread for 
event-handling, one thread... ? I it can, what am I doing wrong?

main()
{

SDL_Init(SDL_INIT_VIDEO);
gfx = SDL_CreateThread (graphics_thread, NULL);

events = SDL_CreateThread (events_thread, NULL);

SDL_WaitThread(gfx, NULL);
SDL_WaitThread(events, NULL);
	
SDL_Quit ();
}

This program behaves very unpredictably...  Sometimes can't get input 
from keyboard, sometimes quits immediatly, sometimes crashes with 
SIGFAULT or hangs, sometimes doesn't open window, but never runs 
correctly...





More information about the SDL mailing list