Two SDL-based processes on same machine lock up?


I’m trying to get two fullscreen SDL (1.2.13) apps to run on separate X screens (:0.0 and :0.1) of the same machine. For testing I’m using the attached sdltest.cpp, which uses OpenGL to draw its stuff. The behaviour that I’m seeing is that when I start one sdltest on the first screen (using DISPLAY=:0.0) followed by the second sdltest on the second screen (DISPLAY=:0.1) they both run fine. But, when I start up the first process, ctrl-Z it to go to sleep and then start the second process this latter one will not run. Attaching to it with gdb shows it to wait in SDL_SetVideoMode:

(gdb) bt
#0 0x00007f2ae07d6bb0 in nanosleep () from /lib/
#1 0x00007f2ae1815fe4 in SDL_Delay () from /usr/lib/
#2 0x00007f2ae17feb1f in ?? () from /usr/lib/
#3 0x00007f2ae17fec54 in ?? () from /usr/lib/
#4 0x00007f2ae17ed147 in ?? () from /usr/lib/
#5 0x00007f2ae17ee989 in SDL_SetVideoMode () from /usr/lib/
#6 0x00000000004015d5 in main ()

If I then awake the first process again the second process will continue and both start to run fine. You may wonder why I care about this situation, but we’re working on a networked display app where multiple display processes will need to synchronize at startup before starting to draw. This waiting on SDL_SetVideoMode() in one process when the other process is started up but waiting (on data from a socket) is causing us headaches and I simply do not understand why two unrelated SDL apps would interfere with each other like this. Can somebody explain why this is happening? Or even, better how to avoid it?

-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdltest.cpp
Type: text/x-c++src
Size: 9791 bytes
Desc: sdltest.cpp