1SDL_CreateMutex(3) SDL API Reference SDL_CreateMutex(3)
2
3
4
6 SDL_CreateMutex - Create a mutex
7
9 #include "SDL.h" #include "SDL_thread.h"
10
11 SDL_mutex *SDL_CreateMutex(void);
12
14 Create a new, unlocked mutex.
15
17 SDL_mutex *mut;
18
19 mut=SDL_CreateMutex();
20 .
21 .
22 if(SDL_mutexP(mut)==-1){
23 fprintf(stderr, "Couldn't lock mutex
24 ");
25 exit(-1);
26 }
27 .
28 /* Do stuff while mutex is locked */
29 .
30 .
31 if(SDL_mutexV(mut)==-1){
32 fprintf(stderr, "Couldn't unlock mutex
33 ");
34 exit(-1);
35 }
36
37 SDL_DestroyMutex(mut);
38
40 SDL_mutexP, SDL_mutexV, SDL_DestroyMutex
41
42
43
44SDL Tue 11 Sep 2001, 23:00 SDL_CreateMutex(3)