0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_mutexP</TITLE
|
|
5 ><META
|
|
6 NAME="GENERATOR"
|
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
|
8 "><LINK
|
|
9 REL="HOME"
|
|
10 TITLE="SDL Library Documentation"
|
|
11 HREF="index.html"><LINK
|
|
12 REL="UP"
|
|
13 TITLE="Multi-threaded Programming"
|
|
14 HREF="thread.html"><LINK
|
|
15 REL="PREVIOUS"
|
|
16 TITLE="SDL_DestroyMutex"
|
|
17 HREF="sdldestroymutex.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="SDL_mutexV"
|
|
20 HREF="sdlmutexv.html"></HEAD
|
|
21 ><BODY
|
|
22 CLASS="REFENTRY"
|
|
23 BGCOLOR="#FFF8DC"
|
|
24 TEXT="#000000"
|
|
25 LINK="#0000ee"
|
|
26 VLINK="#551a8b"
|
|
27 ALINK="#ff0000"
|
|
28 ><DIV
|
|
29 CLASS="NAVHEADER"
|
|
30 ><TABLE
|
|
31 WIDTH="100%"
|
|
32 BORDER="0"
|
|
33 CELLPADDING="0"
|
|
34 CELLSPACING="0"
|
|
35 ><TR
|
|
36 ><TH
|
|
37 COLSPAN="3"
|
|
38 ALIGN="center"
|
|
39 >SDL Library Documentation</TH
|
|
40 ></TR
|
|
41 ><TR
|
|
42 ><TD
|
|
43 WIDTH="10%"
|
|
44 ALIGN="left"
|
|
45 VALIGN="bottom"
|
|
46 ><A
|
|
47 HREF="sdldestroymutex.html"
|
|
48 >Prev</A
|
|
49 ></TD
|
|
50 ><TD
|
|
51 WIDTH="80%"
|
|
52 ALIGN="center"
|
|
53 VALIGN="bottom"
|
|
54 ></TD
|
|
55 ><TD
|
|
56 WIDTH="10%"
|
|
57 ALIGN="right"
|
|
58 VALIGN="bottom"
|
|
59 ><A
|
|
60 HREF="sdlmutexv.html"
|
|
61 >Next</A
|
|
62 ></TD
|
|
63 ></TR
|
|
64 ></TABLE
|
|
65 ><HR
|
|
66 ALIGN="LEFT"
|
|
67 WIDTH="100%"></DIV
|
|
68 ><H1
|
|
69 ><A
|
|
70 NAME="SDLMUTEXP"
|
|
71 >SDL_mutexP</A
|
|
72 ></H1
|
|
73 ><DIV
|
|
74 CLASS="REFNAMEDIV"
|
|
75 ><A
|
|
76 NAME="AEN7247"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_mutexP -- Lock a mutex</DIV
|
|
81 ><DIV
|
|
82 CLASS="REFSYNOPSISDIV"
|
|
83 ><A
|
|
84 NAME="AEN7250"
|
|
85 ></A
|
|
86 ><H2
|
|
87 >Synopsis</H2
|
|
88 ><DIV
|
|
89 CLASS="FUNCSYNOPSIS"
|
|
90 ><A
|
|
91 NAME="AEN7251"
|
|
92 ></A
|
|
93 ><P
|
|
94 ></P
|
|
95 ><PRE
|
|
96 CLASS="FUNCSYNOPSISINFO"
|
|
97 >#include "SDL.h"
|
|
98 #include "SDL_thread.h"</PRE
|
|
99 ><P
|
|
100 ><CODE
|
|
101 ><CODE
|
|
102 CLASS="FUNCDEF"
|
|
103 >int <B
|
|
104 CLASS="FSFUNC"
|
|
105 >SDL_mutexP</B
|
|
106 ></CODE
|
|
107 >(SDL_mutex *mutex);</CODE
|
|
108 ></P
|
|
109 ><P
|
|
110 ></P
|
|
111 ></DIV
|
|
112 ></DIV
|
|
113 ><DIV
|
|
114 CLASS="REFSECT1"
|
|
115 ><A
|
|
116 NAME="AEN7257"
|
|
117 ></A
|
|
118 ><H2
|
|
119 >Description</H2
|
|
120 ><P
|
|
121 >Locks the <TT
|
|
122 CLASS="PARAMETER"
|
|
123 ><I
|
|
124 >mutex</I
|
|
125 ></TT
|
|
126 >, which was previously created with <A
|
|
127 HREF="sdlcreatemutex.html"
|
|
128 ><TT
|
|
129 CLASS="FUNCTION"
|
|
130 >SDL_CreateMutex</TT
|
|
131 ></A
|
|
132 >. If the mutex is already locked then <TT
|
|
133 CLASS="FUNCTION"
|
|
134 >SDL_mutexP</TT
|
|
135 > will not return until it is <A
|
|
136 HREF="sdlmutexv.html"
|
|
137 >unlocked</A
|
|
138 >. Returns <SPAN
|
|
139 CLASS="RETURNVALUE"
|
|
140 >0</SPAN
|
|
141 > on success, or <SPAN
|
|
142 CLASS="RETURNVALUE"
|
|
143 >-1</SPAN
|
|
144 > on an error.</P
|
|
145 ><P
|
|
146 >SDL also defines a macro <TT
|
|
147 CLASS="LITERAL"
|
|
148 >#define SDL_LockMutex(m) SDL_mutexP(m)</TT
|
|
149 >.</P
|
|
150 ></DIV
|
|
151 ><DIV
|
|
152 CLASS="REFSECT1"
|
|
153 ><A
|
|
154 NAME="AEN7269"
|
|
155 ></A
|
|
156 ><H2
|
|
157 >See Also</H2
|
|
158 ><P
|
|
159 ><A
|
|
160 HREF="sdlcreatemutex.html"
|
|
161 ><TT
|
|
162 CLASS="FUNCTION"
|
|
163 >SDL_CreateMutex</TT
|
|
164 ></A
|
|
165 >,
|
|
166 <A
|
|
167 HREF="sdlmutexv.html"
|
|
168 ><TT
|
|
169 CLASS="FUNCTION"
|
|
170 >SDL_mutexV</TT
|
|
171 ></A
|
|
172 ></P
|
|
173 ></DIV
|
|
174 ><DIV
|
|
175 CLASS="NAVFOOTER"
|
|
176 ><HR
|
|
177 ALIGN="LEFT"
|
|
178 WIDTH="100%"><TABLE
|
|
179 WIDTH="100%"
|
|
180 BORDER="0"
|
|
181 CELLPADDING="0"
|
|
182 CELLSPACING="0"
|
|
183 ><TR
|
|
184 ><TD
|
|
185 WIDTH="33%"
|
|
186 ALIGN="left"
|
|
187 VALIGN="top"
|
|
188 ><A
|
|
189 HREF="sdldestroymutex.html"
|
|
190 >Prev</A
|
|
191 ></TD
|
|
192 ><TD
|
|
193 WIDTH="34%"
|
|
194 ALIGN="center"
|
|
195 VALIGN="top"
|
|
196 ><A
|
|
197 HREF="index.html"
|
|
198 >Home</A
|
|
199 ></TD
|
|
200 ><TD
|
|
201 WIDTH="33%"
|
|
202 ALIGN="right"
|
|
203 VALIGN="top"
|
|
204 ><A
|
|
205 HREF="sdlmutexv.html"
|
|
206 >Next</A
|
|
207 ></TD
|
|
208 ></TR
|
|
209 ><TR
|
|
210 ><TD
|
|
211 WIDTH="33%"
|
|
212 ALIGN="left"
|
|
213 VALIGN="top"
|
|
214 >SDL_DestroyMutex</TD
|
|
215 ><TD
|
|
216 WIDTH="34%"
|
|
217 ALIGN="center"
|
|
218 VALIGN="top"
|
|
219 ><A
|
|
220 HREF="thread.html"
|
|
221 >Up</A
|
|
222 ></TD
|
|
223 ><TD
|
|
224 WIDTH="33%"
|
|
225 ALIGN="right"
|
|
226 VALIGN="top"
|
|
227 >SDL_mutexV</TD
|
|
228 ></TR
|
|
229 ></TABLE
|
|
230 ></DIV
|
|
231 ></BODY
|
|
232 ></HTML
|
|
233 > |