|
Size: 1178
Comment: update content - pointers, structs
|
Size: 1233
Comment: Updated answer to question on what is returned on error
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | ||<tablewidth="100%"style="color: rgb(255, 0, 0); text-align: center;">DRAFT || |
| Line 6: | Line 7: |
| Use this function to create a mutex, initialized unlocked *...create a new, unlocked mutex* ^create and initialize an unlocked mutex^. | Use this function to create a new mutex. The mutex is returned as an initialized and unlocked mutex. |
| Line 14: | Line 15: |
| == Return Value == Returns the initialized and unlocked mutex. This is a pointer to SDL's internal mutex data structure. |
|
| Line 15: | Line 18: |
| == Return Value == Returns ^the initialized and unlocked mutex.^ <<Color2(green,What if it fails? NULL? Negative error code?)>> |
On error, NULL is returned. To retrieve error description, call SDL_GetError(); |
| Line 21: | Line 21: |
| * | |
| Line 49: | Line 48: |
| .[[SDL_DestroyMutex]] * .[[SDL_mutexP]] * .[[SDL_mutexV]] * |
. [[SDL_DestroyMutex]] * . [[SDL_mutexP]] * . [[SDL_mutexV]] * |
| Line 54: | Line 53: |
| [[CategoryAPI]], [[CategoryMutex]] | [[CategoryAPI]], CategoryMutex |
DRAFT |
SDL_CreateMutex
Use this function to create a new mutex. The mutex is returned as an initialized and unlocked mutex.
Syntax
SDL_mutex* SDL_CreateMutex(void)
Return Value
Returns the initialized and unlocked mutex. This is a pointer to SDL's internal mutex data structure.
On error, NULL is returned. To retrieve error description, call SDL_GetError();
Code Examples
SDL_mutex *mut;
mut=SDL_CreateMutex();
.
.
if(SDL_mutexP(mut)==-1){
fprintf(stderr, "Couldn't lock mutex\n");
exit(-1);
}
.
/* Do stuff while mutex is locked */
.
.
if(SDL_mutexV(mut)==-1){
fprintf(stderr, "Couldn't unlock mutex\n");
exit(-1);
}
SDL_DestroyMutex(mut);
*
green
Remarks
You can add useful comments here
