Wiki Page Content

Differences between revisions 1 and 2
Revision 1 as of 2010-05-25 04:59:09
Size: 804
Editor: SheenaSmith
Comment: create page, add content (Wed Mar 10 ver; changeset 4428)
Revision 2 as of 2010-09-08 22:10:18
Size: 1013
Editor: SheenaSmith
Comment: update content (old wiki)
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
Use this function to create a mutex, initialized unlocked.

<<Color2(g
reen,Is this grammatically correct? mutex-initialized unlock? mutex(comma) initialized and unlocked? '''create and initialize an unlocked mutex'''?)>>
Use this function to create a mutex, initialized unlocked *...create a new, unlocked mutex* ^create and initialize an unlocked mutex^.
Line 22: Line 20:
You can add your code example here 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);
Line 29: Line 45:
 .[[SDL_DestroyMutex]] ???  .[[SDL_DestroyMutex]] *
 .[[SDL_mutexP]] *
 .[[SDL_mutexV]] *

DRAFT

SDL_CreateMutex

Use this function to create a mutex, initialized unlocked *...create a new, unlocked mutex* create and initialize an unlocked mutex.

Syntax

SDL_mutex* SDL_CreateMutex(void)

Return Value

A pointer to an SDL_mutex structure to be initialized in an unlocked state.

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);

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