Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Twine is a very small threading library for C++.

Build Status

It's similar in scope to TinyThread++, so let's blatantly steal from that project's description:

Need portable threads for your C++ app? Is C++11 unavailable for your target compiler(s)? Is Boost too large?

So why start twine if TinyThread++ already meets those requirements?

  • Twine extends what the C++ standard requires to address a number of shortcomings in the standard (and also TinyThread++).
  • Twine doesn't require embedding into your project, but can be installed system-wide; in particular it supports the pkg-config standard.
  • Twine adds a few convenient multithreading-related constructs such as the tasklet class, extended functionality, etc.

That said, TinyThread++ may well be what you're looking for, precisely because those differences have side-effects you might not like. It's cool, I won't hate you.


  • Dual-licensed! Yes, that's a feature - it means you can use it in FLOSS for free, but can get a license for commercial software, too.
  • Portable
    • tested under Windows, Mac OS X, Linux, FreeBSD and should work under most POSIX compatible systems.
    • tested on x86_64, Arm and MIPS architectures
    • tested with C++11 or later and C++98 compatible compilers.
  • Still relatively faithful to the C++11 standard. That doesn't mean the entire standard's thread-related scope is implemented.
  • Minimal overhead - most functions generate compact inline code.


  • CMake for the build system.
  • Twine uses CppUnit for unit tests only.
  • Twine uses a very limited subset of meta. It's so limited it's barely necessary, but hey, pkg-config makes it easy!

Installation (Ubuntu)

Follow the instructions to add the Ubuntu PPA to your system. Then run (as root):

apt-get install libtwine-dev

This will install the binary package file as well as the development headers and all dependencies.


After installing the requirements, run:

$ cmake .

This will configure the build system. You might want to make sure dependencies are found if they're not installed system wide:

$ PKG_CONFIG_PATH=/path/to/dir/lib/pkgconfig cmake .

Additionally, you might want to specify an installation prefix for the library and header files:

$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/dir .

You can also switch on C++11 mode, which primarily uses the meta library with all C++11 features enabled.

$cmake -DTWINE_USE_CXX11=1 .

Usually, you can just run the following commands to get going:

$ make testsuite && ./testsuite

Install using the DESTDIR environment variable, if necessary:

$ make DESTDIR=/some/prefix install

CI Building

The script uses build-chroot and build-dependencies to create a suitable build environment on CI, possibly on emulated hardware.

Run e.g.

$ ./ x86_64
$ ./ mips




See Authors.