Wiki Page Content

Differences between revisions 7 and 8
Revision 7 as of 2011-02-28 21:28:31
Size: 1233
Editor: Paul Walters
Comment: Updated answer to question on what is returned on error
Revision 8 as of 2011-03-18 21:33:08
Size: 1230
Editor: SheenaSmith
Comment: camelcase pragma change, fix category link, RV to standard format
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
#pragma disable-camelcase #pragma camelcase off
Line 7: Line 7:
Use this function to create a new mutex. The mutex is returned as an initialized and unlocked mutex. Use this function to create a new mutex. ,,The mutex is returned as an initialized and unlocked mutex.,,
Line 15: Line 15:
Line 16: Line 17:
Returns the initialized and unlocked mutex. This is a pointer to SDL's internal mutex data structure. Returns the initialized and unlocked mutex or NULL on failure; call [[SDL_GetError]]() for more information.  
Line 18: Line 19:
On error, NULL is returned. To retrieve error description, call SDL_GetError(); ,,This is a pointer to SDL's internal mutex data structure.,,
Line 53: Line 54:
[[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 or NULL on failure; call SDL_GetError() for more information.

This is a pointer to SDL's internal mutex data structure.

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


CategoryAPI, CategoryMutex

None: SDL_CreateMutex (last edited 2015-08-21 21:22:59 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit