Hello SDL developers–
This is further information on my email from last Friday regarding
a hang in SDL_Init. Here is a very simple test program that
reliably hangs:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <SDL/SDL.h>
int main (int argc, char **argv)
{
XInitThreads();
SDL_Init (SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
printf("SUCCESS!!!!!\n");
exit(0);
}
I am running completely vanilla Red Hat 8.0 with XFree86 4.2.1 and SDL
1.2.5. The program above is saved as the file “sdlhang.c” and compiled as
follows:
gcc -g -O2 -c sdlhang.c
gcc -g -O2 sdlhang.o -o sdlhang -rdynamic
/usr/local/vbrick/lib/libSDL-1.2.so.0 -lpthread -L/usr/X11R6/lib -lXext -lX1
1 -lm -lz
After compiling sdlhang, I run the following shell script:
#!/bin/sh
iter=0
while /bin/true
; do
./sdlhang
iter=`echo $iter + 1 | bc -q`
echo "Completed iteration $iter"
done
After some number of iterations – sometimes on the first iteration,
sometimes up to 2000 iterations – the test program will hang with the
following backtrace:
(gdb) bt
#0 0x42028d69 in sigsuspend () from /lib/i686/libc.so.6
#1 0x400aa108 in __pthread_wait_for_restart_signal ()
from /lib/i686/libpthread.so.0
#2 0x400ac480 in __pthread_alt_lock () from /lib/i686/libpthread.so.0
#3 0x400a8f87 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
#4 0x401289bc in _XLockDisplay () from /usr/X11R6/lib/libX11.so.6
#5 0x4010e0d0 in XMatchVisualInfo () from /usr/X11R6/lib/libX11.so.6
#6 0x400608fd in add_visual () from /usr/lib/libSDL-1.2.so.0
#7 0x40060db9 in X11_GetVideoModes () from /usr/lib/libSDL-1.2.so.0
#8 0x40062a53 in X11_VideoInit () from /usr/lib/libSDL-1.2.so.0
#9 0x400576c3 in SDL_VideoInit () from /usr/lib/libSDL-1.2.so.0
#10 0x40033b85 in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#11 0x40033bc7 in SDL_Init () from /usr/lib/libSDL-1.2.so.0
#12 0x08048607 in main (argc=1, argv=0xbffff824) at sdlhang.c:140
#13 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
I have determined that the problem goes away if I comment out the call
to XInitThreads, but unfortunately I need this elsewhere in my
application.
Any ideas as to where I should look next?
Thanks in advance,
–Howdy=============================
Howdy Pierce
Cardinal Peak, LLC