libcoro  1.0
Coroutine support library for C++20
Classes | Typedefs | Functions | Variables
coro Namespace Reference

main namespace More...

Classes

class  std_allocator
 represents standard allocator for coroutines More...
 
class  reusable_allocator
 Handles allocation of single coroutine, if it is repeatedly allocated and deallocated. More...
 
class  coro_allocator_helper
 inherit this class to include coro_allocator into your promise_type More...
 
class  pmr_allocator
 Creates libcoro compatible allocator which uses an instance of std::pmr::memory_resource for allocations. More...
 
class  async
 COROUTINE: Coroutine for asynchronous operation. More...
 
class  collector
 The collector is a reversed generator. The coroutine consumes values and then returns a result. More...
 
class  condition
 await on a condition More...
 
class  construct_using
 Constructor for emplace. More...
 
class  suspend
 Suspend current coroutine and switch to another coroutine ready to run. More...
 
class  basic_coroutine
 COROUTINE: Basic coroutine. More...
 
class  distributor
 Distributes single event to multiple coroutines (subscribbers) More...
 
class  filtered_update_queue
 A special purpose queue which is intended to filter events sent to slow subscribers. More...
 
class  await_canceled_exception
 Exception is thrown on attempt to retrieve value after promise has been broken. More...
 
class  still_pending_exception
 Exception is thrown on attempt to retrieve promise when the future is already pending. More...
 
class  frame
 Creates coroutine compatible memory layout, so the object acts as an coroutine. More...
 
class  function
 Move only function wrapper with small object optimization. More...
 
class  any
 Movable any replacement with small object optimization - uses coro::function. More...
 
class  future
 Contains future value of T, can be co_awaited in coroutine. More...
 
class  promise
 Carries reference to future<T>, callable, sets value of an associated future<T> More...
 
class  deferred_future
 Contains future value of T, where evaluation is deferred until the value is needed. More...
 
class  shared_future
 Future which can be shared (by copying - like shared_ptr) More...
 
class  pointer_wrapper
 Wraps object into pointer. More...
 
class  all_of
 this awaitable is resolved, when all objects specified by constructor are resolved More...
 
class  when_each
 Process all futures in order of completion. More...
 
class  any_of
 Awaitable returns result of a first complete object. More...
 
class  task_list
 helps to create task list: list of started task as list of futures More...
 
class  future_variant
 makes a variant future - multiple futures shares single space More...
 
class  generator_iterator
 Iterator to access generators. More...
 
class  generator
 COROUTINE: Generator. More...
 
class  generator< R(Args...), Alloc >
 Generator with arguments. More...
 
class  make_awaitable
 Converts any result to awaitable object. More...
 
class  mutex
 Mutex which allows locking across co_await and co_yield suspend points. More...
 
class  on_leave
 Defines function, which is called when function is exited. More...
 
class  pool_alloc
 A corutine allocator that caches unused frames in the pool. More...
 
class  prepared_coro
 contains prepared coroutine (prepared to run) More...
 
class  queue
 Implements asychronous queue with support for coroutines. More...
 
class  scheduler_t
 scheduler for coroutines More...
 
class  semaphore
 Implements semaphore for coroutines. More...
 
class  stackful
 Coroutine allocator emulates coroutine's stack to achieve stackful behaviour. More...
 
class  subscription
 Awaiter for subscriptions. More...
 
class  thread_pool_t
 thread pool implementation More...
 

Typedefs

using coroutine = basic_coroutine< std_allocator >
 COROUTINE: Basic coroutine, always detached, with no return value. More...
 
template<typename T >
using pointer_value = std::decay_t< decltype(*std::declval< T >())>
 determines type of pointer value More...
 
using scheduler = scheduler_t< std::condition_variable >
 scheduler for coroutines More...
 
using thread_pool = thread_pool_t< std::condition_variable >
 Thread pool implementation. More...
 

Functions

template<typename T >
void notify_condition (const T &var) noexcept
 notifies variable about change in the condition. More...
 
template<typename T , std::invocable< prepared_coro > Fn>
void notify_condition (const T &var, Fn &&scheduler) noexcept
 notifies variable about change in the condition. More...
 
template<typename T , typename Pred >
void condition_sync_wait (T &var, Pred &&pred)
 Perform synchronous waiting with condition. More...
 
template<typename T , coro_allocator Alloc = std_allocator>
generator< T, Alloc > aggregator (Alloc &, std::vector< generator< T > > gens)
 Construct generator which aggregates results of multiple generators. More...
 
template<typename T >
generator< T, std_allocatoraggregator (std::vector< generator< T > > gens)
 Construct generator which aggregates results of multiple generators. More...
 
template<typename T , typename Alloc , std::convertible_to< generator< T > > ... Args>
auto aggregator (generator< T, Alloc > &&gen1, Args &&... gens)
 Construct generator which aggregates results of multiple generators. More...
 
template<typename T , typename Alloc , coro_allocator GenAlloc, std::convertible_to< generator< T > > ... Args>
auto aggregator (GenAlloc &genalloc, generator< T, Alloc > &&gen1, Args &&... gens)
 Construct generator which aggregates results of multiple generators. More...
 

Variables

constexpr std_allocator standard_allocator
 Global instance for std_allocator which can be used anywhere the allocator is requested. More...
 
template<typename T >
concept await_suspend_valid_return_value = (std::is_void_v<T>||std::is_convertible_v<T, bool>||std::is_convertible_v<T, std::coroutine_handle<> >)
 Tests, whether T is valid await_suspend return value. More...
 
template<typename T >
concept awaitable = directly_awaitable<T> || indirectly_awaitable<T>
 Tests, whether T is coroutine awaitable. More...
 
template<typename T >
concept iterator_type
 any iterator More...
 
template<typename T >
concept container_type
 any container (must have begin and end) More...
 

Detailed Description

main namespace