Twine is a very small threading library for C++.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jens Finkhaeuser 437a2494c2
Add Ubuntu instructions
6 years ago
CMakeModules - Use compiler flags vor MSVC 6 years ago
data Add installer icon 6 years ago
debian Reset changelog for release into new PPA 6 years ago
deps Twine should use C++11 6 years ago
scripts Add chroot as submodule 6 years ago
test Make testing for time periods elapsed a bit more robust 6 years ago
travis Updated travis files (for future use) 9 years ago
twine I don't know where pthread_getthreadid_np is from, but on FreeBSD we use thr_self() 6 years ago
.gitignore Ignore packaging directory 6 years ago
.gitmodules Twine should use C++11 6 years ago
.travis.yml Allow failures of emulated builds 6 years ago Update authors file 6 years ago
CMakeLists.txt - Simplify compiler flag handling 6 years ago
LICENSE Switch to CMake 9 years ago
README Project boilerplate 9 years ago Add Ubuntu instructions 6 years ago Attempt at building dependencies in full matrix 6 years ago
darwin.txt Attempt at building dependencies in full matrix 6 years ago
linux.txt Attempt at building dependencies in full matrix 6 years ago Add packaging script 6 years ago Fix libdir in pkg-config file to allow for multi-arch packages. 6 years ago


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.