Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

Set up a project

On this page

A project needs three things: the core (header and binary), the module library, and the latest C++ language standard. On Windows a Visual Studio project gets them through a props file and a project reference; on Linux a CMake project gets them through find_package (see Linux below).

Windows

1. Import the core

Core\ThinkMeta.ConcurrentTasks.Core.props adds the include directory for Core.h, links the import library and copies ThinkMeta.ConcurrentTasks.Core.dll next to your executable. Import it in your .vcxproj after Microsoft.Cpp.props:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="path\to\ThinkMeta.ConcurrentTasks\Core\ThinkMeta.ConcurrentTasks.Core.props" />

All configurations use the same release build of the core. It does not depend on the C runtime, so it works in debug builds as well.

2. Reference the library

Add the library project to your solution and reference it, so its modules are built and their interfaces are visible to your code:

<ItemGroup>
  <ProjectReference Include="path\to\ThinkMeta.ConcurrentTasks\Library\ThinkMeta.ConcurrentTasks\ThinkMeta.ConcurrentTasks.vcxproj">
    <Project>{8193c4f2-ccac-4ba7-ad92-ab1a2fad14a2}</Project>
  </ProjectReference>
</ItemGroup>

3. Use the latest C++ standard

In the project properties set C/C++ › Language › C++ Language Standard to Preview – Features from the Latest C++ Working Draft (/std:c++latest), for both configurations.

Linux

A CMake project (clang, Ninja) finds the core and the library through the package configuration in the repository's cmake folder. It brings in the prebuilt libThinkMeta.ConcurrentTasks.Core.so.2 and builds the library's modules as part of your project:

cmake_minimum_required(VERSION 3.28)
project(MyProgram LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)

find_package(ThinkMeta.ConcurrentTasks CONFIG REQUIRED PATHS path/to/ThinkMeta.ConcurrentTasks/cmake)

add_executable(my_program main.cpp)
target_link_libraries(my_program PRIVATE ThinkMeta::ConcurrentTasks)
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++
cmake --build build

ThinkMeta::ConcurrentTasks links the core as well, and the program finds the core through its run path. The repository's own CMakeLists.txt builds the library's tests and the samples that run on Linux the same way.

Include and import

Every source file that uses ConcurrentTasks includes the core header and imports the modules it needs:

#include <ThinkMeta.ConcurrentTasks/Core.h>

import ThinkMeta.ConcurrentTasks.Tasks.WaitableTask;
import ThinkMeta.ConcurrentTasks.Synchronization.Semaphore;

namespace TC = ThinkMeta::ConcurrentTasks;

Each reference page names the module to import under Use. The examples in this documentation abbreviate the namespace as TC.

Next

Your first program.