• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Porting</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../atomic.html" title="Chapter 6. Boost.Atomic">
10<link rel="prev" href="limitations.html" title="Limitations">
11<link rel="next" href="../chrono.html" title="Chapter 7. Boost.Chrono 2.0.8">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<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>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="atomic.porting"></a><a class="link" href="porting.html" title="Porting">Porting</a>
29</h2></div></div></div>
30<div class="toc"><dl class="toc">
31<dt><span class="section"><a href="porting.html#atomic.porting.unit_tests">Unit tests</a></span></dt>
32<dt><span class="section"><a href="porting.html#atomic.porting.tested_compilers">Tested compilers</a></span></dt>
33<dt><span class="section"><a href="porting.html#atomic.porting.acknowledgements">Acknowledgements</a></span></dt>
34</dl></div>
35<div class="section">
36<div class="titlepage"><div><div><h3 class="title">
37<a name="atomic.porting.unit_tests"></a><a class="link" href="porting.html#atomic.porting.unit_tests" title="Unit tests">Unit tests</a>
38</h3></div></div></div>
39<p>
40        <span class="bold"><strong>Boost.Atomic</strong></span> provides a unit test suite
41        to verify that the implementation behaves as expected:
42      </p>
43<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
44<li class="listitem">
45            <span class="bold"><strong>atomic_api.cpp</strong></span> and <span class="bold"><strong>atomic_ref_api.cpp</strong></span>
46            verifies that all atomic operations have correct value semantics (e.g.
47            "fetch_add" really adds the desired value, returning the previous).
48            The latter tests <code class="computeroutput"><span class="identifier">atomic_ref</span></code>
49            rather than <code class="computeroutput"><span class="identifier">atomic</span></code> and
50            <code class="computeroutput"><span class="identifier">atomic_flag</span></code>. It is a
51            rough "smoke-test" to help weed out the most obvious mistakes
52            (for example width overflow, signed/unsigned extension, ...). These tests
53            are also run with <code class="computeroutput"><span class="identifier">BOOST_ATOMIC_FORCE_FALLBACK</span></code>
54            macro defined to test the lock pool based implementation.
55          </li>
56<li class="listitem">
57            <span class="bold"><strong>lockfree.cpp</strong></span> verifies that the <span class="bold"><strong>BOOST_ATOMIC_*_LOCKFREE</strong></span> macros are set properly
58            according to the expectations for a given platform, and that they match
59            up with the <span class="bold"><strong>is_always_lock_free</strong></span> and
60            <span class="bold"><strong>is_lock_free</strong></span> members of the <span class="bold"><strong>atomic</strong></span> object instances.
61          </li>
62<li class="listitem">
63            <span class="bold"><strong>atomicity.cpp</strong></span> and <span class="bold"><strong>atomicity_ref.cpp</strong></span>
64            lets two threads race against each other modifying a shared variable,
65            verifying that the operations behave atomic as appropriate. By nature,
66            this test is necessarily stochastic, and the test self-calibrates to
67            yield 99% confidence that a positive result indicates absence of an error.
68            This test is very useful on uni-processor systems with preemption already.
69          </li>
70<li class="listitem">
71            <span class="bold"><strong>ordering.cpp</strong></span> and <span class="bold"><strong>ordering_ref.cpp</strong></span>
72            lets two threads race against each other accessing multiple shared variables,
73            verifying that the operations exhibit the expected ordering behavior.
74            By nature, this test is necessarily stochastic, and the test attempts
75            to self-calibrate to yield 99% confidence that a positive result indicates
76            absence of an error. This only works on true multi-processor (or multi-core)
77            systems. It does not yield any result on uni-processor systems or emulators
78            (due to there being no observable reordering even the order=relaxed case)
79            and will report that fact.
80          </li>
81<li class="listitem">
82            <span class="bold"><strong>wait_api.cpp</strong></span> and <span class="bold"><strong>wait_ref_api.cpp</strong></span>
83            are used to verify waiting and notifying operations behavior. Due to
84            the possibility of spurious wakeups, these tests may fail if a waiting
85            operation returns early a number of times. The test retries for a few
86            times in this case, but a failure is still possible.
87          </li>
88<li class="listitem">
89            <span class="bold"><strong>wait_fuzz.cpp</strong></span> is a fuzzing test for
90            waiting and notifying operations, that creates a number of threads that
91            block on the same atomic object and then wake up one or all of them for
92            a number of times. This test is intended as a smoke test in case if the
93            implementation has long-term instabilities or races (primarily, in the
94            lock pool implementation).
95          </li>
96<li class="listitem">
97            <span class="bold"><strong>ipc_atomic_api.cpp</strong></span>, <span class="bold"><strong>ipc_atomic_ref_api.cpp</strong></span>,
98            <span class="bold"><strong>ipc_wait_api.cpp</strong></span> and <span class="bold"><strong>ipc_wait_ref_api.cpp</strong></span>
99            are similar to the tests without the <span class="bold"><strong>ipc_</strong></span>
100            prefix, but test IPC atomic types.
101          </li>
102</ul></div>
103</div>
104<div class="section">
105<div class="titlepage"><div><div><h3 class="title">
106<a name="atomic.porting.tested_compilers"></a><a class="link" href="porting.html#atomic.porting.tested_compilers" title="Tested compilers">Tested compilers</a>
107</h3></div></div></div>
108<p>
109        <span class="bold"><strong>Boost.Atomic</strong></span> has been tested on and is known
110        to work on the following compilers/platforms:
111      </p>
112<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
113<li class="listitem">
114            gcc 4.4 and newer: i386, x86_64, ppc32, ppc64, sparcv9, armv6, alpha
115          </li>
116<li class="listitem">
117            clang 3.5 and newer: i386, x86_64
118          </li>
119<li class="listitem">
120            Visual Studio Express 2008 and newer on Windows XP and later: x86, x64,
121            ARM
122          </li>
123</ul></div>
124</div>
125<div class="section">
126<div class="titlepage"><div><div><h3 class="title">
127<a name="atomic.porting.acknowledgements"></a><a class="link" href="porting.html#atomic.porting.acknowledgements" title="Acknowledgements">Acknowledgements</a>
128</h3></div></div></div>
129<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
130            Adam Wulkiewicz created the logo used on the <a href="https://github.com/boostorg/atomic" target="_top">GitHub
131            project page</a>. The logo was taken from his <a href="https://github.com/awulkiew/boost-logos" target="_top">collection</a>
132            of Boost logos.
133          </li></ul></div>
134</div>
135</div>
136<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
137<td align="left"></td>
138<td align="right"><div class="copyright-footer">Copyright © 2011 Helge Bahmann<br>Copyright © 2012 Tim Blechmann<br>Copyright © 2013, 2017, 2018, 2020 Andrey
139      Semashev<p>
140        Distributed under the Boost Software License, Version 1.0. (See accompanying
141        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>)
142      </p>
143</div></td>
144</tr></table>
145<hr>
146<div class="spirit-nav">
147<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>
148</div>
149</body>
150</html>
151