<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>My Project: SDL_atomic.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">My Project </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">SDL_atomic.h</div> </div> </div><!--header--> <div class="contents"> <a href="SDL__atomic_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> Simple DirectMedia Layer</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> This software is provided 'as-is', without any express or implied</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> warranty. In no event will the authors be held liable for any damages</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> arising from the use of this software.</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> Permission is granted to anyone to use this software for any purpose,</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> including commercial applications, and to alter it and redistribute it</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> freely, subject to the following restrictions:</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"></span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> claim that you wrote the original software. If you use this software</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> in a product, an acknowledgment in the product documentation would be</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> appreciated but is not required.</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> misrepresented as being the original software.</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> 3. This notice may not be removed or altered from any source distribution.</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">*/</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="preprocessor">#ifndef SDL_atomic_h_</span></div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="preprocessor">#define SDL_atomic_h_</span></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> <span class="preprocessor">#include "<a class="code" href="SDL__stdinc_8h.html">SDL_stdinc.h</a>"</span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <span class="preprocessor">#include "<a class="code" href="SDL__platform_8h.html">SDL_platform.h</a>"</span></div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="preprocessor">#include "<a class="code" href="begin__code_8h.html">begin_code.h</a>"</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="comment">/* Set up for C function definitions, even when using C++ */</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="comment">/* @{ */</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> SDL_SpinLock;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="keyword">extern</span> DECLSPEC SDL_bool SDLCALL <a class="code" href="SDL__atomic_8h.html#a5410c5f832f0d862282cd65fc432fc0b">SDL_AtomicTryLock</a>(SDL_SpinLock *lock);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a95ecd72190ba8e5ed6ed78d5d1b36509">SDL_AtomicLock</a>(SDL_SpinLock *lock);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a3fb14c56b17347349ac2fb5300205bac">SDL_AtomicUnlock</a>(SDL_SpinLock *lock);</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="comment">/* @} */</span><span class="comment">/* SDL AtomicLock */</span></div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="preprocessor">#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="keywordtype">void</span> _ReadWriteBarrier(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="preprocessor">#pragma intrinsic(_ReadWriteBarrier)</span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="preprocessor">#define SDL_CompilerBarrier() _ReadWriteBarrier()</span></div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="preprocessor">#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="comment">/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */</span></div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <span class="preprocessor">#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="preprocessor">#elif defined(__WATCOMC__)</span></div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="keyword">extern</span> _inline <span class="keywordtype">void</span> <a class="code" href="SDL__atomic_8h.html#a36d435d444dc115a5cc11fa7027576ec">SDL_CompilerBarrier</a> (<span class="keywordtype">void</span>);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="preprocessor">#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];</span></div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="SDL__atomic_8h.html#a36d435d444dc115a5cc11fa7027576ec"> 132</a></span> <span class="preprocessor">#define SDL_CompilerBarrier() \</span></div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="preprocessor">{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }</span></div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span> </div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a4bec96c1fc632536952c309513a0258e">SDL_MemoryBarrierReleaseFunction</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span> SDLCALL SDL_MemoryBarrierAcquireFunction(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> </div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="preprocessor">#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))</span></div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")</span></div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")</span></div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> <span class="preprocessor">#elif defined(__GNUC__) && defined(__aarch64__)</span></div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")</span></div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")</span></div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="preprocessor">#elif defined(__GNUC__) && defined(__arm__)</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="preprocessor">#if 0 </span><span class="comment">/* defined(__LINUX__) || defined(__ANDROID__) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="comment">/* Information from:</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> <span class="comment"> https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> <span class="comment"></span></div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="comment"> The Linux kernel provides a helper function which provides the right code for a memory barrier,</span></div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="comment"> hard-coded at address 0xffff0fa0</span></div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> <span class="comment">*/</span></div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span> <span class="keyword">typedef</span> void (*SDL_KernelMemoryBarrierFunc)();</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()</span></div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()</span></div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> <span class="preprocessor">#elif 0 </span><span class="comment">/* defined(__QNXNTO__) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> <span class="preprocessor">#include <sys/cpuinline.h></span></div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> </div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __cpu_membarrier()</span></div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __cpu_membarrier()</span></div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="preprocessor">#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)</span></div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")</span></div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")</span></div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> <span class="preprocessor">#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)</span></div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> <span class="preprocessor">#ifdef __thumb__</span></div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> <span class="comment">/* The mcr instruction isn't available in thumb mode, use real functions */</span></div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="preprocessor">#define SDL_MEMORY_BARRIER_USES_FUNCTION</span></div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()</span></div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")</span></div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")</span></div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> <span class="preprocessor">#endif </span><span class="comment">/* __thumb__ */</span><span class="preprocessor"></span></div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")</span></div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")</span></div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span> <span class="preprocessor">#endif </span><span class="comment">/* __LINUX__ || __ANDROID__ */</span><span class="preprocessor"></span></div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> <span class="preprocessor">#endif </span><span class="comment">/* __GNUC__ && __arm__ */</span><span class="preprocessor"></span></div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="preprocessor">#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))</span></div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> <span class="comment">/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */</span></div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="preprocessor">#include <mbarrier.h></span></div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() __machine_rel_barrier()</span></div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="comment">/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */</span></div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> <span class="preprocessor">#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> <span class="preprocessor">#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()</span></div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span> </div><div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="structSDL__atomic__t.html"> 216</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <span class="keywordtype">int</span> value; } <a class="code" href="structSDL__atomic__t.html">SDL_atomic_t</a>;</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span> </div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> <span class="keyword">extern</span> DECLSPEC SDL_bool SDLCALL <a class="code" href="SDL__atomic_8h.html#ad6b90be91abb896260930d3908c0437b">SDL_AtomicCAS</a>(<a class="code" href="structSDL__atomic__t.html">SDL_atomic_t</a> *a, <span class="keywordtype">int</span> oldval, <span class="keywordtype">int</span> newval);</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span> </div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">int</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a95b659308ebb16226d5c0cbf2188e51d">SDL_AtomicSet</a>(<a class="code" href="structSDL__atomic__t.html">SDL_atomic_t</a> *a, <span class="keywordtype">int</span> v);</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> </div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">int</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a633c2661709f59c98f128f99aea36d96">SDL_AtomicGet</a>(<a class="code" href="structSDL__atomic__t.html">SDL_atomic_t</a> *a);</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span> </div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">int</span> SDLCALL <a class="code" href="SDL__atomic_8h.html#a36cadfcf8e2bda1974fbce6afdc6d529">SDL_AtomicAdd</a>(<a class="code" href="structSDL__atomic__t.html">SDL_atomic_t</a> *a, <span class="keywordtype">int</span> v);</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> </div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span> <span class="preprocessor">#ifndef SDL_AtomicIncRef</span></div><div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="SDL__atomic_8h.html#a9c3b04a6ce4b6907bfb6e2ea4649ff64"> 252</a></span> <span class="preprocessor">#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)</span></div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span> <span class="preprocessor">#ifndef SDL_AtomicDecRef</span></div><div class="line"><a name="l00262"></a><span class="lineno"><a class="line" href="SDL__atomic_8h.html#a1602c33647cfdfa8ae49a2eef10341c9"> 262</a></span> <span class="preprocessor">#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)</span></div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span> <span class="keyword">extern</span> DECLSPEC SDL_bool SDLCALL <a class="code" href="SDL__atomic_8h.html#aa3070cf7f391b522e08595822c2f0eba">SDL_AtomicCASPtr</a>(<span class="keywordtype">void</span> **a, <span class="keywordtype">void</span> *oldval, <span class="keywordtype">void</span> *newval);</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> </div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span>* SDLCALL <a class="code" href="SDL__atomic_8h.html#a8cd69c02c71a64c2e509dc11a560d075">SDL_AtomicSetPtr</a>(<span class="keywordtype">void</span> **a, <span class="keywordtype">void</span>* v);</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span> </div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span> <span class="keyword">extern</span> DECLSPEC <span class="keywordtype">void</span>* SDLCALL <a class="code" href="SDL__atomic_8h.html#a46e899ee0013f3fae67eedaa6bce8947">SDL_AtomicGetPtr</a>(<span class="keywordtype">void</span> **a);</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span> </div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span> <span class="comment">/* Ends C function definitions when using C++ */</span></div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span> }</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> </div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span> <span class="preprocessor">#include "<a class="code" href="close__code_8h.html">close_code.h</a>"</span></div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="preprocessor">#endif </span><span class="comment">/* SDL_atomic_h_ */</span><span class="preprocessor"></span></div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> </div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span> <span class="comment">/* vi: set ts=4 sw=4 expandtab: */</span></div><div class="ttc" id="SDL__atomic_8h_html_a46e899ee0013f3fae67eedaa6bce8947"><div class="ttname"><a href="SDL__atomic_8h.html#a46e899ee0013f3fae67eedaa6bce8947">SDL_AtomicGetPtr</a></div><div class="ttdeci">DECLSPEC void *SDLCALL SDL_AtomicGetPtr(void **a)</div><div class="ttdoc">Get the value of a pointer atomically.</div></div> <div class="ttc" id="SDL__atomic_8h_html_a95b659308ebb16226d5c0cbf2188e51d"><div class="ttname"><a href="SDL__atomic_8h.html#a95b659308ebb16226d5c0cbf2188e51d">SDL_AtomicSet</a></div><div class="ttdeci">DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v)</div><div class="ttdoc">Set an atomic variable to a value.</div></div> <div class="ttc" id="SDL__atomic_8h_html_a633c2661709f59c98f128f99aea36d96"><div class="ttname"><a href="SDL__atomic_8h.html#a633c2661709f59c98f128f99aea36d96">SDL_AtomicGet</a></div><div class="ttdeci">DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a)</div><div class="ttdoc">Get the value of an atomic variable.</div></div> <div class="ttc" id="SDL__atomic_8h_html_a8cd69c02c71a64c2e509dc11a560d075"><div class="ttname"><a href="SDL__atomic_8h.html#a8cd69c02c71a64c2e509dc11a560d075">SDL_AtomicSetPtr</a></div><div class="ttdeci">DECLSPEC void *SDLCALL SDL_AtomicSetPtr(void **a, void *v)</div><div class="ttdoc">Set a pointer to a value atomically.</div></div> <div class="ttc" id="SDL__platform_8h_html"><div class="ttname"><a href="SDL__platform_8h.html">SDL_platform.h</a></div></div> <div class="ttc" id="SDL__atomic_8h_html_a36d435d444dc115a5cc11fa7027576ec"><div class="ttname"><a href="SDL__atomic_8h.html#a36d435d444dc115a5cc11fa7027576ec">SDL_CompilerBarrier</a></div><div class="ttdeci">#define SDL_CompilerBarrier()</div><div class="ttdef"><b>Definition:</b> SDL_atomic.h:132</div></div> <div class="ttc" id="begin__code_8h_html"><div class="ttname"><a href="begin__code_8h.html">begin_code.h</a></div></div> <div class="ttc" id="SDL__stdinc_8h_html"><div class="ttname"><a href="SDL__stdinc_8h.html">SDL_stdinc.h</a></div></div> <div class="ttc" id="SDL__atomic_8h_html_aa3070cf7f391b522e08595822c2f0eba"><div class="ttname"><a href="SDL__atomic_8h.html#aa3070cf7f391b522e08595822c2f0eba">SDL_AtomicCASPtr</a></div><div class="ttdeci">DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval)</div><div class="ttdoc">Set a pointer to a new value if it is currently an old value.</div></div> <div class="ttc" id="SDL__atomic_8h_html_a5410c5f832f0d862282cd65fc432fc0b"><div class="ttname"><a href="SDL__atomic_8h.html#a5410c5f832f0d862282cd65fc432fc0b">SDL_AtomicTryLock</a></div><div class="ttdeci">DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock)</div><div class="ttdoc">Try to lock a spin lock by setting it to a non-zero value.</div></div> <div class="ttc" id="close__code_8h_html"><div class="ttname"><a href="close__code_8h.html">close_code.h</a></div></div> <div class="ttc" id="SDL__atomic_8h_html_a95ecd72190ba8e5ed6ed78d5d1b36509"><div class="ttname"><a href="SDL__atomic_8h.html#a95ecd72190ba8e5ed6ed78d5d1b36509">SDL_AtomicLock</a></div><div class="ttdeci">DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock)</div><div class="ttdoc">Lock a spin lock by setting it to a non-zero value.</div></div> <div class="ttc" id="SDL__atomic_8h_html_ad6b90be91abb896260930d3908c0437b"><div class="ttname"><a href="SDL__atomic_8h.html#ad6b90be91abb896260930d3908c0437b">SDL_AtomicCAS</a></div><div class="ttdeci">DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)</div><div class="ttdoc">Set an atomic variable to a new value if it is currently an old value.</div></div> <div class="ttc" id="SDL__atomic_8h_html_a36cadfcf8e2bda1974fbce6afdc6d529"><div class="ttname"><a href="SDL__atomic_8h.html#a36cadfcf8e2bda1974fbce6afdc6d529">SDL_AtomicAdd</a></div><div class="ttdeci">DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v)</div><div class="ttdoc">Add to an atomic variable.</div></div> <div class="ttc" id="structSDL__atomic__t_html"><div class="ttname"><a href="structSDL__atomic__t.html">SDL_atomic_t</a></div><div class="ttdoc">A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...</div><div class="ttdef"><b>Definition:</b> SDL_atomic.h:216</div></div> <div class="ttc" id="SDL__atomic_8h_html_a4bec96c1fc632536952c309513a0258e"><div class="ttname"><a href="SDL__atomic_8h.html#a4bec96c1fc632536952c309513a0258e">SDL_MemoryBarrierReleaseFunction</a></div><div class="ttdeci">DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void)</div></div> <div class="ttc" id="SDL__atomic_8h_html_a3fb14c56b17347349ac2fb5300205bac"><div class="ttname"><a href="SDL__atomic_8h.html#a3fb14c56b17347349ac2fb5300205bac">SDL_AtomicUnlock</a></div><div class="ttdeci">DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock)</div><div class="ttdoc">Unlock a spin lock by setting it to 0. Always returns immediately.</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.15 </small></address> </body> </html>