|
Size: 790
Comment: update content - standard return value
|
Size: 1490
Comment: update content (old wiki)
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 6: | Line 6: |
| Use this function to lock the mutex. | Use this function to lock ,,the,, ^a^ mutex. |
| Line 16: | Line 16: |
| ||'''mutex'''||^a pointer to the SDL_mutex structure to be locked^|| | ||'''mutex'''||^a pointer to the SDL_mutex structure / mutex to be locked^|| |
| Line 27: | Line 27: |
| <<Color2(green,define SDL_LockMutex(m) SDL_mutexP(m))>> ??? | *<<BR>>[[SDL_mutexP]]() locks the mutex, which was previously created with [[SDL_CreateMutex]](). If the mutex is already locked by another thread then [[SDL_mutexP]]() will not return until the thread that locked it unlocks it (with [[SDL_mutexV]]()). If called repeatedly on a mutex, [[SDL_mutexV]]() must be called ^an^ equal ,,amount,, ^number^ of times to return the mutex to ^the/an^ unlocked state. |
| Line 29: | Line 29: |
| ''You can add useful comments here'' | SDL also defines a macro `#define SDL_LockMutex(m) SDL_mutexP(m)`. <<BR>>* ''-or-'' [[SDL_mutexP]](m) and SDL_!LockMutex(m) are equivalent. ''-or-'' The macro SDL_!LockMutex(m) will call [[SDL_mutexP]](m). <<Color2(green,I'm guessing this !LockMutex part will actually be omitted but I left it in since it was mentioned in the old wiki.)>> |
| Line 32: | Line 40: |
| .[[SDL_mutexV]] ??? | .[[SDL_CreateMutex]] * .[[SDL_mutexV]] * |
DRAFT |
SDL_mutexP
Use this function to lock the a mutex.
Syntax
int SDL_mutexP(SDL_mutex* mutex)
Function Parameters
mutex |
a pointer to the SDL_mutex structure / mutex to be locked |
Return Value
Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.
Code Examples
You can add your code example here
Remarks
*
SDL_mutexP() locks the mutex, which was previously created with SDL_CreateMutex(). If the mutex is already locked by another thread then SDL_mutexP() will not return until the thread that locked it unlocks it (with SDL_mutexV()). If called repeatedly on a mutex, SDL_mutexV() must be called an equal amount number of times to return the mutex to the/an unlocked state.
SDL also defines a macro #define SDL_LockMutex(m) SDL_mutexP(m).
*
-or-
SDL_mutexP(m) and SDL_LockMutex(m) are equivalent.
-or- The macro SDL_LockMutex(m) will call SDL_mutexP(m).
green
