Hi list,
I have recently stumbled upon some weird behavior of SDL_CondWait under
Linux:
while (!predicate)
SDL_CondWait(cond, mutex);
SDL_UnlockMutex(mutex);
SDL_LockMutex(mutex);
I had assumed that the SDL sync primitives behaved exactly like their
pthread counterparts,
and looking at the source code, this ought to be true, however, the thread
seems to get stuck
on “LockMutex” even though the mutex is supposed to be unlocked, and I
cannot for the life of
me figure out what is happening.
I have attached a sample C++ program that demonstrates this and also
contains the exact
same code rewritten with pthreads, which works perfectly as expected.
Thanks,
Jonas
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdlCondBug.c
Type: text/x-csrc
Size: 2008 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130910/c6fce9cc/attachment.c