1 <HTML 2 ><HEAD 3 ><TITLE 4 >SDL_DestroySemaphore</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_CreateSemaphore" 17 HREF="sdlcreatesemaphore.html"><LINK 18 REL="NEXT" 19 TITLE="SDL_SemWait" 20 HREF="sdlsemwait.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="sdlcreatesemaphore.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="sdlsemwait.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="SDLDESTROYSEMAPHORE" 74 ></A 75 >SDL_DestroySemaphore</H1 76 ><DIV 77 CLASS="REFNAMEDIV" 78 ><A 79 NAME="AEN7982" 80 ></A 81 ><H2 82 >Name</H2 83 >SDL_DestroySemaphore -- Destroys a semaphore that was created by <A 84 HREF="sdlcreatesemaphore.html" 85 >SDL_CreateSemaphore</A 86 >.</DIV 87 ><DIV 88 CLASS="REFSYNOPSISDIV" 89 ><A 90 NAME="AEN7986" 91 ></A 92 ><H2 93 >Synopsis</H2 94 ><DIV 95 CLASS="FUNCSYNOPSIS" 96 ><A 97 NAME="AEN7987" 98 ></A 99 ><P 100 ></P 101 ><PRE 102 CLASS="FUNCSYNOPSISINFO" 103 >#include "SDL.h" 104 #include "SDL_thread.h"</PRE 105 ><P 106 ><CODE 107 ><CODE 108 CLASS="FUNCDEF" 109 >void <B 110 CLASS="FSFUNC" 111 >SDL_DestroySemaphore</B 112 ></CODE 113 >(SDL_sem *sem);</CODE 114 ></P 115 ><P 116 ></P 117 ></DIV 118 ></DIV 119 ><DIV 120 CLASS="REFSECT1" 121 ><A 122 NAME="AEN7993" 123 ></A 124 ><H2 125 >Description</H2 126 ><P 127 ><TT 128 CLASS="FUNCTION" 129 >SDL_DestroySemaphore</TT 130 > destroys the semaphore pointed to 131 by <TT 132 CLASS="PARAMETER" 133 ><I 134 >sem</I 135 ></TT 136 > that was created by 137 <A 138 HREF="sdlcreatesemaphore.html" 139 ><TT 140 CLASS="FUNCTION" 141 >SDL_CreateSemaphore</TT 142 ></A 143 >. 144 It is not safe to destroy a semaphore if there are threads currently blocked 145 waiting on it.</P 146 ></DIV 147 ><DIV 148 CLASS="REFSECT1" 149 ><A 150 NAME="AEN8000" 151 ></A 152 ><H2 153 >Examples</H2 154 ><P 155 ><PRE 156 CLASS="PROGRAMLISTING" 157 >if (my_sem != NULL) { 158 SDL_DestroySemaphore(my_sem); 159 my_sem = NULL; 160 }</PRE 161 ></P 162 ></DIV 163 ><DIV 164 CLASS="REFSECT1" 165 ><A 166 NAME="AEN8004" 167 ></A 168 ><H2 169 >See Also</H2 170 ><P 171 ><A 172 HREF="sdlcreatesemaphore.html" 173 ><TT 174 CLASS="FUNCTION" 175 >SDL_CreateSemaphore</TT 176 ></A 177 >, 178 <A 179 HREF="sdlsemwait.html" 180 ><TT 181 CLASS="FUNCTION" 182 >SDL_SemWait</TT 183 ></A 184 >, 185 <A 186 HREF="sdlsemtrywait.html" 187 ><TT 188 CLASS="FUNCTION" 189 >SDL_SemTryWait</TT 190 ></A 191 >, 192 <A 193 HREF="sdlsemwaittimeout.html" 194 ><TT 195 CLASS="FUNCTION" 196 >SDL_SemWaitTimeout</TT 197 ></A 198 >, 199 <A 200 HREF="sdlsempost.html" 201 ><TT 202 CLASS="FUNCTION" 203 >SDL_SemPost</TT 204 ></A 205 >, 206 <A 207 HREF="sdlsemvalue.html" 208 ><TT 209 CLASS="FUNCTION" 210 >SDL_SemValue</TT 211 ></A 212 ></P 213 ></DIV 214 ><DIV 215 CLASS="NAVFOOTER" 216 ><HR 217 ALIGN="LEFT" 218 WIDTH="100%"><TABLE 219 SUMMARY="Footer navigation table" 220 WIDTH="100%" 221 BORDER="0" 222 CELLPADDING="0" 223 CELLSPACING="0" 224 ><TR 225 ><TD 226 WIDTH="33%" 227 ALIGN="left" 228 VALIGN="top" 229 ><A 230 HREF="sdlcreatesemaphore.html" 231 ACCESSKEY="P" 232 >Prev</A 233 ></TD 234 ><TD 235 WIDTH="34%" 236 ALIGN="center" 237 VALIGN="top" 238 ><A 239 HREF="index.html" 240 ACCESSKEY="H" 241 >Home</A 242 ></TD 243 ><TD 244 WIDTH="33%" 245 ALIGN="right" 246 VALIGN="top" 247 ><A 248 HREF="sdlsemwait.html" 249 ACCESSKEY="N" 250 >Next</A 251 ></TD 252 ></TR 253 ><TR 254 ><TD 255 WIDTH="33%" 256 ALIGN="left" 257 VALIGN="top" 258 >SDL_CreateSemaphore</TD 259 ><TD 260 WIDTH="34%" 261 ALIGN="center" 262 VALIGN="top" 263 ><A 264 HREF="thread.html" 265 ACCESSKEY="U" 266 >Up</A 267 ></TD 268 ><TD 269 WIDTH="33%" 270 ALIGN="right" 271 VALIGN="top" 272 >SDL_SemWait</TD 273 ></TR 274 ></TABLE 275 ></DIV 276 ></BODY 277 ></HTML 278 >