Question regarding threading and SDL_mutexes

Few questions which I’m sure will end with “redesign your code” but anyway…

What happens to a SDL_mutex if it’s destroyed (SDL_DestroyMutex())
whilst locked? Is it platform specific? Will SDL_mutexP() return on
other waiting threads? Is it safe to do this and rely on the return
value of SDL_mutexP() in other threads to determine that the mutex is dead?

Cheers,

Martyn McDonnell–
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005

Martyn McDonnell wrote:

Few questions which I’m sure will end with “redesign your code” but
anyway…

What happens to a SDL_mutex if it’s destroyed (SDL_DestroyMutex())
whilst locked? Is it platform specific? Will SDL_mutexP() return on
other waiting threads? Is it safe to do this and rely on the return
value of SDL_mutexP() in other threads to determine that the mutex is dead?

Cheers,

Martyn McDonnell

I have to ask this…
Why the heck would you destroy a mutex that’s still being used?

Jonathan Atkins wrote:

Martyn McDonnell wrote:

Few questions which I’m sure will end with “redesign your code” but
anyway…

What happens to a SDL_mutex if it’s destroyed (SDL_DestroyMutex())
whilst locked? Is it platform specific? Will SDL_mutexP() return on
other waiting threads? Is it safe to do this and rely on the return
value of SDL_mutexP() in other threads to determine that the mutex is
dead?

Cheers,

Martyn McDonnell

I have to ask this…
Why the heck would you destroy a mutex that’s still being used?

Heh, you think about a problem for long enough, you kinda go to weird
places and think of convoluted ways of doing something simple.

So yeah, bad idea that was :P. Setting a flag for the thread func to
check after SDL_mutexP() returns would work.

I’m gunna go lie down for a while…–
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005