No description, website, or topics provided.
CMake C++ Python
Switch branches/tags
Nothing to show
Clone or download
preshing Merge pull request #1 from bobsayshilol/RandomDelay-fix
Initialise RandomDelay's random values and prevent a hang if any of the values weren't a multiple of 8
Latest commit d9f3261 Nov 22, 2017


AcquireRelease is a sample application which complements the blog post, This Is Why They Call It a Weakly-Ordered CPU.

It demonstrates the kind of memory reordering which only happens on weakly-ordered CPUs, assuming no compiler reordering takes place.


CMake 2.8.9 or later. It might work using earlier versions of CMake if you edit CMakeLists.txt, but I didn't test this. The CMake executable must be available in your path.

A compiler toolchain which supports C++11 threads and atomics. I tested it using Xcode 4.5.1 on OSX Mountain Lion 10.8.2, and Visual Studio 2012 on Windows 7.

If you're targeting iOS, your device must be running iOS 5.0 or later. You must also have your developer certificate and provisioning profiles already set up. If you're able to build and run sample applications, you should be good to go.

How to Build and Run on iOS Devices


Open build/AcquireRelease.xcodeproj.

Select AcquireRelease as the target scheme using the drop-down list available by clicking the Scheme box.

Click Run.


  • The Xcode project is generated using a slightly modified version of this CMake toolchain file. Specifically, I modified it to additionally search for the iOS Developer folder under /Applications/, which is where it was for me after installing Xcode via the App Store on Mountain Lion.
  • When using the resulting generated Xcode project, you won't be able to set source-level breakpoints. Assembly-level breakpoints still work, though.

How to Build on Other Platforms

Make a build subdirectory, run cmake -G "<generator>" .. in that subdirectory, then use the resulting solution, project or makefile. To see a list of available generators, run cmake by itself. For example, for Visual Studio 2012, I used the following command line:

cmake -G "Visual Studio 11" ..