| Home | Libraries | People | FAQ | More

## Porting

### Unit tests

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 with 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.

### Tested compilers

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

- gcc 4.x: i386, x86_64, ppc32, ppc64, armv5, armv6, alpha
- Visual Studio Express 2008/Windows XP, i386

If you have an unsupported platform, contact me and I will work to add support for it.