diff options
Diffstat (limited to 'static/freebsd/man3/ATOMIC_VAR_INIT.3 3.html')
| -rw-r--r-- | static/freebsd/man3/ATOMIC_VAR_INIT.3 3.html | 315 |
1 files changed, 0 insertions, 315 deletions
diff --git a/static/freebsd/man3/ATOMIC_VAR_INIT.3 3.html b/static/freebsd/man3/ATOMIC_VAR_INIT.3 3.html deleted file mode 100644 index 5149c119..00000000 --- a/static/freebsd/man3/ATOMIC_VAR_INIT.3 3.html +++ /dev/null @@ -1,315 +0,0 @@ -<table class="head"> - <tr> - <td class="head-ltitle">ATOMIC_VAR_INIT(3)</td> - <td class="head-vol">Library Functions Manual</td> - <td class="head-rtitle">ATOMIC_VAR_INIT(3)</td> - </tr> -</table> -<div class="manual-text"> -<section class="Sh"> -<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> -<p class="Pp"><code class="Nm">ATOMIC_VAR_INIT</code>, - <code class="Nm">atomic_init</code>, <code class="Nm">atomic_load</code>, - <code class="Nm">atomic_store</code>, - <code class="Nm">atomic_exchange</code>, - <code class="Nm">atomic_compare_exchange_strong</code>, - <code class="Nm">atomic_compare_exchange_weak</code>, - <code class="Nm">atomic_fetch_add</code>, - <code class="Nm">atomic_fetch_and</code>, - <code class="Nm">atomic_fetch_or</code>, - <code class="Nm">atomic_fetch_sub</code>, - <code class="Nm">atomic_fetch_xor</code>, - <code class="Nm">atomic_is_lock_free</code> — - <span class="Nd">type-generic atomic operations</span></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> -<p class="Pp"><code class="In">#include - <<a class="In">stdatomic.h</a>></code></p> -<p class="Pp">_Atomic(T) <var class="Fa">v</var> = ATOMIC_VAR_INIT(c); - <br/> - <var class="Ft">void</var> - <br/> - <code class="Fn">atomic_init</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - value</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_load</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_load_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">memory_order - order</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">atomic_store</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">atomic_store_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T desired</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_exchange</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_exchange_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T desired</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">_Bool</var> - <br/> - <code class="Fn">atomic_compare_exchange_strong</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - *expected</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>);</p> -<p class="Pp"><var class="Ft">_Bool</var> - <br/> - <code class="Fn">atomic_compare_exchange_strong_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - *expected</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>, <var class="Fa" style="white-space: nowrap;">memory_order - success</var>, <var class="Fa" style="white-space: nowrap;">memory_order - failure</var>);</p> -<p class="Pp"><var class="Ft">_Bool</var> - <br/> - <code class="Fn">atomic_compare_exchange_weak</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - *expected</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>);</p> -<p class="Pp"><var class="Ft">_Bool</var> - <br/> - <code class="Fn">atomic_compare_exchange_weak_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - *expected</var>, <var class="Fa" style="white-space: nowrap;">T - desired</var>, <var class="Fa" style="white-space: nowrap;">memory_order - success</var>, <var class="Fa" style="white-space: nowrap;">memory_order - failure</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_add</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - operand</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_add_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T operand</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_and</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - operand</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_and_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T operand</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_or</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - operand</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_or_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T operand</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_sub</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - operand</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_sub_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T operand</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_xor</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T - operand</var>);</p> -<p class="Pp"><var class="Ft">T</var> - <br/> - <code class="Fn">atomic_fetch_xor_explicit</code>(<var class="Fa" style="white-space: nowrap;">_Atomic(T) - *object</var>, <var class="Fa" style="white-space: nowrap;">T operand</var>, - <var class="Fa" style="white-space: nowrap;">memory_order order</var>);</p> -<p class="Pp"><var class="Ft">_Bool</var> - <br/> - <code class="Fn">atomic_is_lock_free</code>(<var class="Fa" style="white-space: nowrap;">const - _Atomic(T) *object</var>);</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> -<p class="Pp">The header - <code class="In"><<a class="In">stdatomic.h</a>></code> provides - type-generic macros for atomic operations. Atomic operations can be used by - multithreaded programs to provide shared variables between threads that in - most cases may be modified without acquiring locks.</p> -<p class="Pp" id="_Atomic">Atomic variables are declared using the - <a class="permalink" href="#_Atomic"><code class="Fn">_Atomic</code></a>() - type specifier. These variables are not type-compatible with their - non-atomic counterparts. Depending on the compiler used, atomic variables - may be opaque and can therefore only be influenced using the macros - described.</p> -<p class="Pp" id="atomic_init">The - <a class="permalink" href="#atomic_init"><code class="Fn">atomic_init</code></a>() - macro initializes the atomic variable <var class="Fa">object</var> with a - <var class="Fa">value</var>. Atomic variables can be initialized while being - declared using - <a class="permalink" href="#ATOMIC_VAR_INIT"><code class="Fn" id="ATOMIC_VAR_INIT">ATOMIC_VAR_INIT</code></a>().</p> -<p class="Pp" id="atomic_load">The - <a class="permalink" href="#atomic_load"><code class="Fn">atomic_load</code></a>() - macro returns the value of atomic variable <var class="Fa">object</var>. The - <a class="permalink" href="#atomic_store"><code class="Fn" id="atomic_store">atomic_store</code></a>() - macro sets the atomic variable <var class="Fa">object</var> to its - <var class="Fa">desired</var> value.</p> -<p class="Pp" id="atomic_exchange">The - <a class="permalink" href="#atomic_exchange"><code class="Fn">atomic_exchange</code></a>() - macro combines the behaviour of <code class="Fn">atomic_load</code>() and - <code class="Fn">atomic_store</code>(). It sets the atomic variable - <var class="Fa">object</var> to its desired <var class="Fa">value</var> and - returns the original contents of the atomic variable.</p> -<p class="Pp" id="atomic_compare_exchange_strong">The - <a class="permalink" href="#atomic_compare_exchange_strong"><code class="Fn">atomic_compare_exchange_strong</code></a>() - macro stores a <var class="Fa">desired</var> value into atomic variable - <var class="Fa">object</var>, only if the atomic variable is equal to its - <var class="Fa">expected</var> value. Upon success, the macro returns - <code class="Dv">true</code>. Upon failure, the - <var class="Fa">desired</var> value is overwritten with the value of the - atomic variable and <code class="Dv">false</code> is returned. The - <a class="permalink" href="#atomic_compare_exchange_weak"><code class="Fn" id="atomic_compare_exchange_weak">atomic_compare_exchange_weak</code></a>() - macro is identical to - <code class="Fn">atomic_compare_exchange_strong</code>(), but is allowed to - fail even if atomic variable <var class="Fa">object</var> is equal to its - <var class="Fa">expected</var> value.</p> -<p class="Pp" id="atomic_fetch_add">The - <a class="permalink" href="#atomic_fetch_add"><code class="Fn">atomic_fetch_add</code></a>() - macro adds the value <var class="Fa">operand</var> to atomic variable - <var class="Fa">object</var> and returns the original contents of the atomic - variable.</p> -<p class="Pp" id="atomic_fetch_and">The - <a class="permalink" href="#atomic_fetch_and"><code class="Fn">atomic_fetch_and</code></a>() - macro applies the - <a class="permalink" href="#and"><i class="Em" id="and">and</i></a> operator - to atomic variable <var class="Fa">object</var> and - <var class="Fa">operand</var> and stores the value into - <var class="Fa">object</var>, while returning the original contents of the - atomic variable.</p> -<p class="Pp" id="atomic_fetch_or">The - <a class="permalink" href="#atomic_fetch_or"><code class="Fn">atomic_fetch_or</code></a>() - macro applies the - <a class="permalink" href="#or"><i class="Em" id="or">or</i></a> operator to - atomic variable <var class="Fa">object</var> and - <var class="Fa">operand</var> and stores the value into - <var class="Fa">object</var>, while returning the original contents of the - atomic variable.</p> -<p class="Pp" id="atomic_fetch_sub">The - <a class="permalink" href="#atomic_fetch_sub"><code class="Fn">atomic_fetch_sub</code></a>() - macro subtracts the value <var class="Fa">operand</var> from atomic variable - <var class="Fa">object</var> and returns the original contents of the atomic - variable.</p> -<p class="Pp" id="atomic_fetch_xor">The - <a class="permalink" href="#atomic_fetch_xor"><code class="Fn">atomic_fetch_xor</code></a>() - macro applies the - <a class="permalink" href="#xor"><i class="Em" id="xor">xor</i></a> operator - to atomic variable <var class="Fa">object</var> and - <var class="Fa">operand</var> and stores the value into - <var class="Fa">object</var>, while returning the original contents of the - atomic variable.</p> -<p class="Pp" id="atomic_is_lock_free">The - <a class="permalink" href="#atomic_is_lock_free"><code class="Fn">atomic_is_lock_free</code></a>() - macro returns whether atomic variable <var class="Fa">object</var> uses - locks when using atomic operations.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="BARRIERS"><a class="permalink" href="#BARRIERS">BARRIERS</a></h1> -<p class="Pp">The atomic operations described previously are implemented in such - a way that they disallow both the compiler and the executing processor to - re-order any nearby memory operations across the atomic operation. In - certain cases this behaviour may cause suboptimal performance. To mitigate - this, every atomic operation has an <code class="Fn">_explicit</code>() - version that allows the re-ordering to be configured.</p> -<p class="Pp" id="_explicit">The <var class="Fa">order</var> parameter of these - <a class="permalink" href="#_explicit"><code class="Fn">_explicit</code></a>() - macros can have one of the following values.</p> -<dl class="Bl-tag"> - <dt id="memory_order_relaxed"><a class="permalink" href="#memory_order_relaxed"><code class="Dv">memory_order_relaxed</code></a></dt> - <dd>No operation orders memory.</dd> - <dt id="memory_order_consume"><a class="permalink" href="#memory_order_consume"><code class="Dv">memory_order_consume</code></a></dt> - <dd>Perform consume operation.</dd> - <dt id="memory_order_acquire"><a class="permalink" href="#memory_order_acquire"><code class="Dv">memory_order_acquire</code></a></dt> - <dd>Acquire fence.</dd> - <dt id="memory_order_release"><a class="permalink" href="#memory_order_release"><code class="Dv">memory_order_release</code></a></dt> - <dd>Release fence.</dd> - <dt id="memory_order_acq_rel"><a class="permalink" href="#memory_order_acq_rel"><code class="Dv">memory_order_acq_rel</code></a></dt> - <dd>Acquire and release fence.</dd> - <dt id="memory_order_seq_cst"><a class="permalink" href="#memory_order_seq_cst"><code class="Dv">memory_order_seq_cst</code></a></dt> - <dd>Sequentially consistent acquire and release fence.</dd> -</dl> -<p class="Pp" id="_explicit~2">The previously described macros are identical to - the - <a class="permalink" href="#_explicit~2"><code class="Fn">_explicit</code></a>() - macros, when <var class="Fa">order</var> is - <code class="Dv">memory_order_seq_cst</code>.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="COMPILER_SUPPORT"><a class="permalink" href="#COMPILER_SUPPORT">COMPILER - SUPPORT</a></h1> -<p class="Pp">These atomic operations are typically implemented by the compiler, - as they must be implemented type-generically and must often use special - hardware instructions. As this interface has not been adopted by most - compilers yet, the - <code class="In"><<a class="In">stdatomic.h</a>></code> header - implements these macros on top of existing compiler intrinsics to provide - forward compatibility.</p> -<p class="Pp">This means that certain aspects of the interface, such as support - for different barrier types may simply be ignored. When using GCC, all - atomic operations are executed as if they are using - <code class="Dv">memory_order_seq_cst</code>.</p> -<p class="Pp">Instead of using the atomic operations provided by this interface, - <span class="St">ISO/IEC 9899:2011 (“ISO C11”)</span> - allows the atomic variables to be modified directly using built-in language - operators. This behaviour cannot be emulated for older compilers. To prevent - unintended non-atomic access to these variables, this header file places the - atomic variable in a structure when using an older compiler.</p> -<p class="Pp">When using GCC on architectures on which it lacks support for - built-in atomic intrinsics, these macros may emit function calls to fallback - routines. These fallback routines are only implemented for 32-bits and - 64-bits datatypes, if supported by the CPU.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE - ALSO</a></h1> -<p class="Pp"><a class="Xr">pthread(3)</a>, <a class="Xr">atomic(9)</a></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="STANDARDS"><a class="permalink" href="#STANDARDS">STANDARDS</a></h1> -<p class="Pp">These macros attempt to conform to <span class="St">ISO/IEC - 9899:2011 (“ISO C11”)</span>.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> -<p class="Pp">These macros appeared in <span class="Ux">FreeBSD 10.0</span>.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> -<p class="Pp"><span class="An">Ed Schouten</span> - <<a class="Mt" href="mailto:ed@FreeBSD.org">ed@FreeBSD.org</a>> - <br/> - <span class="An">David Chisnall</span> - <<a class="Mt" href="mailto:theraven@FreeBSD.org">theraven@FreeBSD.org</a>></p> -</section> -</div> -<table class="foot"> - <tr> - <td class="foot-date">December 27, 2011</td> - <td class="foot-os">FreeBSD 15.0</td> - </tr> -</table> |
