mcpp index

compat.libcoro

#include

libcoro — C++20 coroutine tasks, generators, thread pool and awaitable synchronisation

#include <coro/event.hpp>
mcpp add compat.libcoro@0.16.0

Usage

From this repository's own test project — built and run by CI, not written for the website.

// Behavioral test — compat.libcoro actually schedules coroutines.
//
// Every assertion here needs a resumed coroutine to be true, so a package that
// compiled the headers but linked none of the eight core TUs fails: the
// thread_pool, event, mutex and sync_wait entry points all live in those.
//
// Networking is deliberately untouched — see the descriptor. `coro/coro.hpp`
// is NOT included for the same reason; it opens the net/ headers behind
// LIBCORO_FEATURE_NETWORKING, which this build does not define.
//
// No `import std;`: libcoro's headers are textual over the standard library.
#include <coro/event.hpp>
#include <coro/generator.hpp>
#include <coro/mutex.hpp>
#include <coro/sync_wait.hpp>
#include <coro/task.hpp>
#include <coro/thread_pool.hpp>
#include <coro/when_all.hpp>

#include <atomic>
#include <cstdio>
#include <vector>
// …

tests/examples/libcoro/tests/coroutines.cpp · project tests/examples/libcoro

Build

targets
libcoro (lib)
language
c++23
C standard
c11
import std
no
include dirs
*/include, mcpp_generated

Sources (8)

  • */src/detail/task_self_deleting.cpp
  • */src/condition_variable.cpp
  • */src/default_executor.cpp
  • */src/event.cpp
  • */src/mutex.cpp
  • */src/semaphore.cpp
  • */src/sync_wait.cpp
  • */src/thread_pool.cpp

Generated files

  • mcpp_generated/coro/export.hpp

Versions

VersionPlatforms Mirrorssha256
0.16.0 latest LinuxWindowsmacOS CN GLOBAL 895ca24e6c73…