151 lines
9.5 KiB
HTML
151 lines
9.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Porting</title>
|
||
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
|
||
<link rel="up" href="../atomic.html" title="Chapter 6. Boost.Atomic">
|
||
<link rel="prev" href="limitations.html" title="Limitations">
|
||
<link rel="next" href="../chrono.html" title="Chapter 7. Boost.Chrono 2.0.8">
|
||
</head>
|
||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
<table cellpadding="2" width="100%"><tr>
|
||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
|
||
<td align="center"><a href="../../../index.html">Home</a></td>
|
||
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||
<td align="center"><a href="../../../more/index.htm">More</a></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="limitations.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../atomic.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../chrono.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||
<a name="atomic.porting"></a><a class="link" href="porting.html" title="Porting">Porting</a>
|
||
</h2></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="porting.html#atomic.porting.unit_tests">Unit tests</a></span></dt>
|
||
<dt><span class="section"><a href="porting.html#atomic.porting.tested_compilers">Tested compilers</a></span></dt>
|
||
<dt><span class="section"><a href="porting.html#atomic.porting.acknowledgements">Acknowledgements</a></span></dt>
|
||
</dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="atomic.porting.unit_tests"></a><a class="link" href="porting.html#atomic.porting.unit_tests" title="Unit tests">Unit tests</a>
|
||
</h3></div></div></div>
|
||
<p>
|
||
<span class="bold"><strong>Boost.Atomic</strong></span> provides a unit test suite
|
||
to verify that the implementation behaves as expected:
|
||
</p>
|
||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||
<li class="listitem">
|
||
<span class="bold"><strong>atomic_api.cpp</strong></span> and <span class="bold"><strong>atomic_ref_api.cpp</strong></span>
|
||
verifies that all atomic operations have correct value semantics (e.g.
|
||
"fetch_add" really adds the desired value, returning the previous).
|
||
The latter tests <code class="computeroutput"><span class="identifier">atomic_ref</span></code>
|
||
rather than <code class="computeroutput"><span class="identifier">atomic</span></code> and
|
||
<code class="computeroutput"><span class="identifier">atomic_flag</span></code>. It is a
|
||
rough "smoke-test" to help weed out the most obvious mistakes
|
||
(for example width overflow, signed/unsigned extension, ...). These tests
|
||
are also run with <code class="computeroutput"><span class="identifier">BOOST_ATOMIC_FORCE_FALLBACK</span></code>
|
||
macro defined to test the lock pool based implementation.
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>lockfree.cpp</strong></span> verifies that the <span class="bold"><strong>BOOST_ATOMIC_*_LOCKFREE</strong></span> macros are set properly
|
||
according to the expectations for a given platform, and that they match
|
||
up with the <span class="bold"><strong>is_always_lock_free</strong></span> and
|
||
<span class="bold"><strong>is_lock_free</strong></span> members of the <span class="bold"><strong>atomic</strong></span> object instances.
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>atomicity.cpp</strong></span> and <span class="bold"><strong>atomicity_ref.cpp</strong></span>
|
||
lets two threads race against each other modifying a shared variable,
|
||
verifying that the operations behave atomic as appropriate. By nature,
|
||
this test is necessarily stochastic, and the test self-calibrates to
|
||
yield 99% confidence that a positive result indicates absence of an error.
|
||
This test is very useful on uni-processor systems with preemption already.
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>ordering.cpp</strong></span> and <span class="bold"><strong>ordering_ref.cpp</strong></span>
|
||
lets two threads race against each other accessing multiple shared variables,
|
||
verifying that the operations exhibit the expected ordering behavior.
|
||
By nature, this test is necessarily stochastic, and the test attempts
|
||
to self-calibrate to yield 99% confidence that a positive result indicates
|
||
absence of an error. This only works on true multi-processor (or multi-core)
|
||
systems. It does not yield any result on uni-processor systems or emulators
|
||
(due to there being no observable reordering even the order=relaxed case)
|
||
and will report that fact.
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>wait_api.cpp</strong></span> and <span class="bold"><strong>wait_ref_api.cpp</strong></span>
|
||
are used to verify waiting and notifying operations behavior. Due to
|
||
the possibility of spurious wakeups, these tests may fail if a waiting
|
||
operation returns early a number of times. The test retries for a few
|
||
times in this case, but a failure is still possible.
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>wait_fuzz.cpp</strong></span> is a fuzzing test for
|
||
waiting and notifying operations, that creates a number of threads that
|
||
block on the same atomic object and then wake up one or all of them for
|
||
a number of times. This test is intended as a smoke test in case if the
|
||
implementation has long-term instabilities or races (primarily, in the
|
||
lock pool implementation).
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="bold"><strong>ipc_atomic_api.cpp</strong></span>, <span class="bold"><strong>ipc_atomic_ref_api.cpp</strong></span>,
|
||
<span class="bold"><strong>ipc_wait_api.cpp</strong></span> and <span class="bold"><strong>ipc_wait_ref_api.cpp</strong></span>
|
||
are similar to the tests without the <span class="bold"><strong>ipc_</strong></span>
|
||
prefix, but test IPC atomic types.
|
||
</li>
|
||
</ul></div>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="atomic.porting.tested_compilers"></a><a class="link" href="porting.html#atomic.porting.tested_compilers" title="Tested compilers">Tested compilers</a>
|
||
</h3></div></div></div>
|
||
<p>
|
||
<span class="bold"><strong>Boost.Atomic</strong></span> has been tested on and is known
|
||
to work on the following compilers/platforms:
|
||
</p>
|
||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||
<li class="listitem">
|
||
gcc 4.4 and newer: i386, x86_64, ppc32, ppc64, sparcv9, armv6, alpha
|
||
</li>
|
||
<li class="listitem">
|
||
clang 3.5 and newer: i386, x86_64
|
||
</li>
|
||
<li class="listitem">
|
||
Visual Studio Express 2008 and newer on Windows XP and later: x86, x64,
|
||
ARM
|
||
</li>
|
||
</ul></div>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="atomic.porting.acknowledgements"></a><a class="link" href="porting.html#atomic.porting.acknowledgements" title="Acknowledgements">Acknowledgements</a>
|
||
</h3></div></div></div>
|
||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||
Adam Wulkiewicz created the logo used on the <a href="https://github.com/boostorg/atomic" target="_top">GitHub
|
||
project page</a>. The logo was taken from his <a href="https://github.com/awulkiew/boost-logos" target="_top">collection</a>
|
||
of Boost logos.
|
||
</li></ul></div>
|
||
</div>
|
||
</div>
|
||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||
<td align="left"></td>
|
||
<td align="right"><div class="copyright-footer">Copyright © 2011 Helge Bahmann<br>Copyright © 2012 Tim Blechmann<br>Copyright © 2013, 2017, 2018, 2020 Andrey
|
||
Semashev<p>
|
||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||
</p>
|
||
</div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="limitations.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../atomic.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../chrono.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
</body>
|
||
</html>
|