Configurable C++ platform adapter
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
samples TLSPtrTester: add missing stdlib.h include Mar 16, 2016
.gitignore Fixed Boost and x64 issues Mar 7, 2016
CMakeLists.txt Add turf::util::swap() Jun 5, 2016
LICENSE Add project description to license Feb 9, 2016

Turf is a configurable C++ platform adapter. It defines a common API for:

  • Thread creation
  • Thread affinities
  • Thread IDs
  • Atomic operations
  • Mutexes
  • Condition variables
  • Read-write locks
  • Semaphores
  • Events
  • Timers
  • Virtual memory
  • Heap allocators
  • Asserts

It then implements those things using POSIX, Win32, Mach, Linux, Boost, C++11 and possibly other platform APIs. You configure Turf to use the API you want.

Turf is used by Junction, a library of concurrent data structures in C++.


Turf uses the Simplified BSD License. You can use the source code freely in any project, including commercial applications, as long as you give credit by publishing the contents of the LICENSE file in your documentation somewhere.

Why Not Use C++11?

Junction was originally developed in C++11, but quickly ran into various limitations. Turf was written to address those limitations.

  • Turf exposes affinities, integer thread IDs, semaphores and a few other things that C++11 does not.
  • Turf is configurable, so you can compare implementations and even provide your own. The standard C++11 library is not configurable.
  • Turf atomics have more flexible initialization, copy and cast rules than C++11 atomics.
  • Turf can be used by developers who don't have access to a C++11 compiler.

Adding Turf to Your Project

For now, refer to Junction's README file for instructions.


If you have any comments or feedback, feel free to open an issue on GitHub, or send a direct message using the contact form on my blog.