Semaphore problems

Earlier today I was using a video player that uses SDL, it managed to
SDL_Init(), but segfaulted for whatever reason. Before I ran this
program, my other SDL using applications worked fine, now when I try they
all return “Couldn’t create semaphore”, leading me to believe SDL dropped
a semaphore somewhere and kind of locked itself up. Any idea how to
remedy this, or to flush the semaphores? Thanks in advance.

-Miles Peterson

Earlier today I was using a video player that uses SDL, it managed to
SDL_Init(), but segfaulted for whatever reason. Before I ran this
program, my other SDL using applications worked fine, now when I try they
all return “Couldn’t create semaphore”, leading me to believe SDL dropped
a semaphore somewhere and kind of locked itself up. Any idea how to
remedy this, or to flush the semaphores? Thanks in advance.

I’m assuming that you are running UNIX?
If so, try using the ipcs and ipcrm commands to view and remove stale
shared memory and semaphores.

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

Sam Lantinga writes:

Earlier today I was using a video player that uses SDL, it managed to
SDL_Init(), but segfaulted for whatever reason. Before I ran this
program, my other SDL using applications worked fine, now when I try they
all return “Couldn’t create semaphore”, leading me to believe SDL dropped
a semaphore somewhere and kind of locked itself up. Any idea how to
remedy this, or to flush the semaphores? Thanks in advance.

I’m assuming that you are running UNIX?
If so, try using the ipcs and ipcrm commands to view and remove stale
shared memory and semaphores.

Hi Sam,

I've had a lot of problems with SDL's semaphores in the sense that

they leave behind a lot of stale semaphores, when a SDL application
segfaults (I use Linux 2.2.17). I even created a bash alias to remove
the semaphores SDL leaves behind :wink:

clear_sdl is aliased to for i inipcs -s | grep livio | cut -d’ ‘-f2`; do ipcrm sem $i; done’

Has this been discussed before? Or maybe it not SDL’s fault? Oh,
perhaps it’s Linux ipc which does this?

By the way, GREAT job on SDL all of you out there! I’ve been
following your list for about a few months now, and all of you seem
like fine gents!

bye yall,–
Livio <@Livio_Baldini_Soares>