|
Size: 913
Comment:
|
← Revision 8 as of 2013-10-04 13:35:45 ⇥
Size: 937
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 27: | Line 27: |
| .[[SDL_TryLockMutex]] |
SDL_DestroyMutex
Use this function to destroy a mutex created with SDL_CreateMutex().
Syntax
void SDL_DestroyMutex(SDL_mutex* mutex)
Function Parameters
mutex |
the mutex to destroy |
Code Examples
SDL_mutex *mutex;
mutex = SDL_CreateMutex();
if (!mutex) {
fprintf(stderr, "Couldn't create mutex\n");
return;
}
if (SDL_LockMutex(mutex) == 0) {
/* Do stuff while mutex is locked */
SDL_UnlockMutex(mutex);
} else {
fprintf(stderr, "Couldn't lock mutex\n");
}
SDL_DestroyMutex(mutex);
Remarks
This function must be called on any mutex that is no longer needed. Failure to destroy a mutex will result in a system memory or resource leak. While it is safe to destroy a mutex that is UNLOCKED, it is not safe to attempt to destroy a locked mutex and may result in undefined behavior depending on the platform.
