|
Size: 1399
Comment: Added code example, udpated remarks
|
Size: 1405
Comment: camelcase pragma change, fixed links
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 2: | Line 2: |
| #pragma disable-camelcase | #pragma camelcase off |
| Line 15: | Line 15: |
| Line 39: | Line 40: |
| SDL_DestroyMutex 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. | [[SDL_DestroyMutex]] 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. |
| Line 47: | Line 48: |
| [[CategoryAPI]], CategoryMutex | [[CategoryAPI]], [[CategoryMutex]] |
DRAFT |
SDL_DestroyMutex
Use this function to destroy a mutex.
Syntax
void SDL_DestroyMutex(SDL_mutex* mutex)
Function Parameters
mutex |
the mutex to destroy |
Code Examples
SDL_mutex *mutex;
//First create the mutex..
mutex = SDL_CreateMutex();
// ... use mutex in code
// When done using the mutex, destroy it
// MAKE sure to unlock the mutex prior to destroying it
if( SDL_mutexV( mutex ) )
printf("\nSDL Mutex unlock error:%s", SDL_GetError());
else
// When done with the mutex delete it
SDL_DestroyMutex( mutex );
Remarks
SDL_DestroyMutex 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.
Any attempt to reference a mutex after it has been destroyed will cause access to an invalid memory pointer which may lead to memory corruption or a segmentation fault.
