Home | History | Annotate | Download | only in html
      1 <HTML
      2 ><HEAD
      3 ><TITLE
      4 >SDL_mutexP</TITLE
      5 ><META
      6 NAME="GENERATOR"
      7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
      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 SUMMARY="Header navigation table"
     32 WIDTH="100%"
     33 BORDER="0"
     34 CELLPADDING="0"
     35 CELLSPACING="0"
     36 ><TR
     37 ><TH
     38 COLSPAN="3"
     39 ALIGN="center"
     40 >SDL Library Documentation</TH
     41 ></TR
     42 ><TR
     43 ><TD
     44 WIDTH="10%"
     45 ALIGN="left"
     46 VALIGN="bottom"
     47 ><A
     48 HREF="sdldestroymutex.html"
     49 ACCESSKEY="P"
     50 >Prev</A
     51 ></TD
     52 ><TD
     53 WIDTH="80%"
     54 ALIGN="center"
     55 VALIGN="bottom"
     56 ></TD
     57 ><TD
     58 WIDTH="10%"
     59 ALIGN="right"
     60 VALIGN="bottom"
     61 ><A
     62 HREF="sdlmutexv.html"
     63 ACCESSKEY="N"
     64 >Next</A
     65 ></TD
     66 ></TR
     67 ></TABLE
     68 ><HR
     69 ALIGN="LEFT"
     70 WIDTH="100%"></DIV
     71 ><H1
     72 ><A
     73 NAME="SDLMUTEXP"
     74 ></A
     75 >SDL_mutexP</H1
     76 ><DIV
     77 CLASS="REFNAMEDIV"
     78 ><A
     79 NAME="AEN7872"
     80 ></A
     81 ><H2
     82 >Name</H2
     83 >SDL_mutexP&nbsp;--&nbsp;Lock a mutex</DIV
     84 ><DIV
     85 CLASS="REFSYNOPSISDIV"
     86 ><A
     87 NAME="AEN7875"
     88 ></A
     89 ><H2
     90 >Synopsis</H2
     91 ><DIV
     92 CLASS="FUNCSYNOPSIS"
     93 ><A
     94 NAME="AEN7876"
     95 ></A
     96 ><P
     97 ></P
     98 ><PRE
     99 CLASS="FUNCSYNOPSISINFO"
    100 >#include "SDL.h"
    101 #include "SDL_thread.h"</PRE
    102 ><P
    103 ><CODE
    104 ><CODE
    105 CLASS="FUNCDEF"
    106 >int <B
    107 CLASS="FSFUNC"
    108 >SDL_mutexP</B
    109 ></CODE
    110 >(SDL_mutex *mutex);</CODE
    111 ></P
    112 ><P
    113 ></P
    114 ></DIV
    115 ></DIV
    116 ><DIV
    117 CLASS="REFSECT1"
    118 ><A
    119 NAME="AEN7882"
    120 ></A
    121 ><H2
    122 >Description</H2
    123 ><P
    124 >Locks the <TT
    125 CLASS="PARAMETER"
    126 ><I
    127 >mutex</I
    128 ></TT
    129 >, which was previously created with <A
    130 HREF="sdlcreatemutex.html"
    131 ><TT
    132 CLASS="FUNCTION"
    133 >SDL_CreateMutex</TT
    134 ></A
    135 >. If the mutex is already locked then <TT
    136 CLASS="FUNCTION"
    137 >SDL_mutexP</TT
    138 > will not return until it is <A
    139 HREF="sdlmutexv.html"
    140 >unlocked</A
    141 >. Returns <SPAN
    142 CLASS="RETURNVALUE"
    143 >0</SPAN
    144 > on success, or <SPAN
    145 CLASS="RETURNVALUE"
    146 >-1</SPAN
    147 > on an error.</P
    148 ><P
    149 >SDL also defines a macro <TT
    150 CLASS="LITERAL"
    151 >#define SDL_LockMutex(m) SDL_mutexP(m)</TT
    152 >.</P
    153 ></DIV
    154 ><DIV
    155 CLASS="REFSECT1"
    156 ><A
    157 NAME="AEN7894"
    158 ></A
    159 ><H2
    160 >See Also</H2
    161 ><P
    162 ><A
    163 HREF="sdlcreatemutex.html"
    164 ><TT
    165 CLASS="FUNCTION"
    166 >SDL_CreateMutex</TT
    167 ></A
    168 >,
    169 <A
    170 HREF="sdlmutexv.html"
    171 ><TT
    172 CLASS="FUNCTION"
    173 >SDL_mutexV</TT
    174 ></A
    175 ></P
    176 ></DIV
    177 ><DIV
    178 CLASS="NAVFOOTER"
    179 ><HR
    180 ALIGN="LEFT"
    181 WIDTH="100%"><TABLE
    182 SUMMARY="Footer navigation table"
    183 WIDTH="100%"
    184 BORDER="0"
    185 CELLPADDING="0"
    186 CELLSPACING="0"
    187 ><TR
    188 ><TD
    189 WIDTH="33%"
    190 ALIGN="left"
    191 VALIGN="top"
    192 ><A
    193 HREF="sdldestroymutex.html"
    194 ACCESSKEY="P"
    195 >Prev</A
    196 ></TD
    197 ><TD
    198 WIDTH="34%"
    199 ALIGN="center"
    200 VALIGN="top"
    201 ><A
    202 HREF="index.html"
    203 ACCESSKEY="H"
    204 >Home</A
    205 ></TD
    206 ><TD
    207 WIDTH="33%"
    208 ALIGN="right"
    209 VALIGN="top"
    210 ><A
    211 HREF="sdlmutexv.html"
    212 ACCESSKEY="N"
    213 >Next</A
    214 ></TD
    215 ></TR
    216 ><TR
    217 ><TD
    218 WIDTH="33%"
    219 ALIGN="left"
    220 VALIGN="top"
    221 >SDL_DestroyMutex</TD
    222 ><TD
    223 WIDTH="34%"
    224 ALIGN="center"
    225 VALIGN="top"
    226 ><A
    227 HREF="thread.html"
    228 ACCESSKEY="U"
    229 >Up</A
    230 ></TD
    231 ><TD
    232 WIDTH="33%"
    233 ALIGN="right"
    234 VALIGN="top"
    235 >SDL_mutexV</TD
    236 ></TR
    237 ></TABLE
    238 ></DIV
    239 ></BODY
    240 ></HTML
    241 >