Home | History | Annotate | Download | only in html
      1 <HTML
      2 ><HEAD
      3 ><TITLE
      4 >SDL_SemPost</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_SemWaitTimeout"
     17 HREF="sdlsemwaittimeout.html"><LINK
     18 REL="NEXT"
     19 TITLE="SDL_SemValue"
     20 HREF="sdlsemvalue.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="sdlsemwaittimeout.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="sdlsemvalue.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="SDLSEMPOST"
     74 ></A
     75 >SDL_SemPost</H1
     76 ><DIV
     77 CLASS="REFNAMEDIV"
     78 ><A
     79 NAME="AEN8170"
     80 ></A
     81 ><H2
     82 >Name</H2
     83 >SDL_SemPost&nbsp;--&nbsp;Unlock a semaphore.</DIV
     84 ><DIV
     85 CLASS="REFSYNOPSISDIV"
     86 ><A
     87 NAME="AEN8173"
     88 ></A
     89 ><H2
     90 >Synopsis</H2
     91 ><DIV
     92 CLASS="FUNCSYNOPSIS"
     93 ><A
     94 NAME="AEN8174"
     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_SemPost</B
    109 ></CODE
    110 >(SDL_sem *sem);</CODE
    111 ></P
    112 ><P
    113 ></P
    114 ></DIV
    115 ></DIV
    116 ><DIV
    117 CLASS="REFSECT1"
    118 ><A
    119 NAME="AEN8180"
    120 ></A
    121 ><H2
    122 >Description</H2
    123 ><P
    124 ><TT
    125 CLASS="FUNCTION"
    126 >SDL_SemPost</TT
    127 > unlocks the semaphore pointed to by
    128 <TT
    129 CLASS="PARAMETER"
    130 ><I
    131 >sem</I
    132 ></TT
    133 > and atomically increments the semaphores value.
    134 Threads that were blocking on the semaphore may be scheduled after this call
    135 succeeds.</P
    136 ><P
    137 ><TT
    138 CLASS="FUNCTION"
    139 >SDL_SemPost</TT
    140 > should be called after a semaphore is locked by a successful call to
    141 <A
    142 HREF="sdlsemwait.html"
    143 >SDL_SemWait</A
    144 >,
    145 <A
    146 HREF="sdlsemtrywait.html"
    147 >SDL_SemTryWait</A
    148 > or
    149 <A
    150 HREF="sdlsemwaittimeout.html"
    151 >SDL_SemWaitTimeout</A
    152 >.</P
    153 ></DIV
    154 ><DIV
    155 CLASS="REFSECT1"
    156 ><A
    157 NAME="AEN8190"
    158 ></A
    159 ><H2
    160 >Return Value</H2
    161 ><P
    162 >Returns <SPAN
    163 CLASS="RETURNVALUE"
    164 >0</SPAN
    165 > if successful or
    166 <SPAN
    167 CLASS="RETURNVALUE"
    168 >-1</SPAN
    169 > if there was an error (leaving the semaphore unchanged).</P
    170 ></DIV
    171 ><DIV
    172 CLASS="REFSECT1"
    173 ><A
    174 NAME="AEN8195"
    175 ></A
    176 ><H2
    177 >Examples</H2
    178 ><P
    179 ><PRE
    180 CLASS="PROGRAMLISTING"
    181 >SDL_SemPost(my_sem);</PRE
    182 ></P
    183 ></DIV
    184 ><DIV
    185 CLASS="REFSECT1"
    186 ><A
    187 NAME="AEN8199"
    188 ></A
    189 ><H2
    190 >See Also</H2
    191 ><P
    192 ><A
    193 HREF="sdlcreatesemaphore.html"
    194 ><TT
    195 CLASS="FUNCTION"
    196 >SDL_CreateSemaphore</TT
    197 ></A
    198 >,
    199 <A
    200 HREF="sdldestroysemaphore.html"
    201 ><TT
    202 CLASS="FUNCTION"
    203 >SDL_DestroySemaphore</TT
    204 ></A
    205 >,
    206 <A
    207 HREF="sdlsemwait.html"
    208 ><TT
    209 CLASS="FUNCTION"
    210 >SDL_SemWait</TT
    211 ></A
    212 >,
    213 <A
    214 HREF="sdlsemtrywait.html"
    215 ><TT
    216 CLASS="FUNCTION"
    217 >SDL_SemTryWait</TT
    218 ></A
    219 >,
    220 <A
    221 HREF="sdlsemwaittimeout.html"
    222 ><TT
    223 CLASS="FUNCTION"
    224 >SDL_SemWaitTimeout</TT
    225 ></A
    226 >,
    227 <A
    228 HREF="sdlsemvalue.html"
    229 ><TT
    230 CLASS="FUNCTION"
    231 >SDL_SemValue</TT
    232 ></A
    233 ></P
    234 ></DIV
    235 ><DIV
    236 CLASS="NAVFOOTER"
    237 ><HR
    238 ALIGN="LEFT"
    239 WIDTH="100%"><TABLE
    240 SUMMARY="Footer navigation table"
    241 WIDTH="100%"
    242 BORDER="0"
    243 CELLPADDING="0"
    244 CELLSPACING="0"
    245 ><TR
    246 ><TD
    247 WIDTH="33%"
    248 ALIGN="left"
    249 VALIGN="top"
    250 ><A
    251 HREF="sdlsemwaittimeout.html"
    252 ACCESSKEY="P"
    253 >Prev</A
    254 ></TD
    255 ><TD
    256 WIDTH="34%"
    257 ALIGN="center"
    258 VALIGN="top"
    259 ><A
    260 HREF="index.html"
    261 ACCESSKEY="H"
    262 >Home</A
    263 ></TD
    264 ><TD
    265 WIDTH="33%"
    266 ALIGN="right"
    267 VALIGN="top"
    268 ><A
    269 HREF="sdlsemvalue.html"
    270 ACCESSKEY="N"
    271 >Next</A
    272 ></TD
    273 ></TR
    274 ><TR
    275 ><TD
    276 WIDTH="33%"
    277 ALIGN="left"
    278 VALIGN="top"
    279 >SDL_SemWaitTimeout</TD
    280 ><TD
    281 WIDTH="34%"
    282 ALIGN="center"
    283 VALIGN="top"
    284 ><A
    285 HREF="thread.html"
    286 ACCESSKEY="U"
    287 >Up</A
    288 ></TD
    289 ><TD
    290 WIDTH="33%"
    291 ALIGN="right"
    292 VALIGN="top"
    293 >SDL_SemValue</TD
    294 ></TR
    295 ></TABLE
    296 ></DIV
    297 ></BODY
    298 ></HTML
    299 >