Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Porting

Unit tests
Tested compilers
Acknowledgements

Boost.Atomic provides a unit test suite to verify that the implementation behaves as expected:

  • fallback_api.cpp verifies that the fallback-to-locking aspect of Boost.Atomic compiles and has correct value semantics.
  • native_api.cpp verifies that all atomic operations have correct value semantics (e.g. "fetch_add" really adds the desired value, returning the previous). It is a rough "smoke-test" to help weed out the most obvious mistakes (for example width overflow, signed/unsigned extension, ...).
  • lockfree.cpp verifies that the BOOST_ATOMIC_*_LOCKFREE macros are set properly according to the expectations for a given platform, and that they match up with the is_lock_free member functions of the atomic object instances.
  • atomicity.cpp 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.
  • ordering.cpp 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.

Boost.Atomic has been tested on and is known to work on the following compilers/platforms:

  • gcc 4.x: i386, x86_64, ppc32, ppc64, sparcv9, armv6, alpha
  • Visual Studio Express 2008/Windows XP, x86, x64, ARM

PrevUpHomeNext