[SDL] SDL Semaphore implementation broken on Windows?
slouken at devolution.com
Thu Dec 27 19:22:21 PST 2007
> However, assuming this is the cause of my problems, there is a very
> simple fix:
> Windows provides InterlockedIncrement() and InterlockedDecrement()
> functions to perform
> increments and decrements which are guaranteed to be atomic.
> So the fix is in thread/win32/SDL_syssem.c:
> replace occurrences of --sem->count with InterlockedDecrement(&sem->count);
> and replace occurrences of ++sem->count with
I'm pretty sure the 32-bit ++ and -- operators are atomic on x86 architectures.
Are you sure this fixes the problem?
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment
More information about the SDL