Squashed 'third_party/marl/' changes from 5f31df137..12872a0df

12872a0df Comments: Improve & make style consistent
5bb61cf6a Scheduler: Ensure all scheduled tasks are finished when the scheduler is destructed.
b5e3e1e00 src\scheduler_test.cpp: Reduce max number of in-flight tasks.
d13286050 src\osfiber_windows.h: Assert that the Win32 fiber calls succeeded.
08da5139c .gitignore - Add Visual Studio generated files.
8007ea5de Temporarily disable DestructWithPendingFibers test.
5390897be Fix alignment of Pool items.
89425dcbc CMakeLists: Bump MSVC warnings to level 4
6df4597c3 Kokoro: Shuffle presubmit file layouts.
e3b3c7df4 Add include/marl/memory.h for aligned memory allocations.
60598ef45 Fix TSAN issue with BlockingCall test.
be3628456 CMakeLists: Add TSAN build flag

git-subtree-dir: third_party/marl
git-subtree-split: 12872a0dfe717ab75a7cf8e10621d723b8a1a382
30 files changed
tree: d25c0ef1e679845434c58d4745f91b3d6a6d6926
  1. examples/
  2. include/
  3. kokoro/
  4. src/
  5. third_party/
  6. .clang-format
  7. .gitignore
  8. .gitmodules
  9. AUTHORS
  10. BUILD.bazel
  11. CMakeLists.txt
  12. CONTRIBUTING.md
  13. LICENSE
  14. README.md
  15. WORKSPACE
README.md

Marl

Marl is a hybrid thread / fiber task scheduler written in C++ 11.

About

Marl is a C++ 11 library that provides a fluent interface for running tasks across a number of threads.

Marl uses a combination of fibers and threads to allow efficient execution of tasks that can block, while keeping a fixed number of hardware threads.

Marl supports Windows, macOS, Linux, Fuchsia and Android (arm, aarch64, ppc64 (ELFv2), x86 and x64).

Marl has no dependencies on other libraries (with exception on googletest for building the optional unit tests).

Marl is in early development and will have breaking API changes.

More documentation and examples coming soon.

Note: This is not an officially supported Google product

Building

Marl contains a number of unit tests and examples which can be built using CMake.

Unit tests require fetching the googletest external project, which can be done by typing the following in your terminal:

cd <path-to-marl>
git submodule update --init

Linux and macOS

To build the unit tests and examples, type the following in your terminal:

cd <path-to-marl>
mkdir build
cd build
cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1
make

The resulting binaries will be found in <path-to-marl>/build

Windows

Marl can be built using Visual Studio 2019's CMake integration.

Using Marl in your CMake project

You can build and link Marl using add_subdirectory() in your project's CMakeLists.txt file:

set(MARL_DIR <path-to-marl>) # example <path-to-marl>: "${CMAKE_CURRENT_SOURCE_DIR}/third_party/marl"
add_subdirectory(${MARL_DIR})

This will define the marl library target, which you can pass to target_link_libraries():

target_link_libraries(<target> marl) # replace <target> with the name of your project's target

You will also want to add the marl public headers to your project's include search paths so you can #include the marl headers:

target_include_directories($<target> PRIVATE "${MARL_DIR}/include") # replace <target> with the name of your project's target