work 0.1.0
A gig is a bunch of related work. The pool does the work.
Loading...
Searching...
No Matches
work.ccm File Reference
module work

Typed gigs with private stacks and stochastic work pushing. More...

#include <hint.h>
#include <algorithm>
#include <atomic>
#include <chrono>
#include <concepts>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <mutex>
#include <random>
#include <span>
#include <stdexcept>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  work::gig_options
 Bound a gig's concurrency or keep all its callbacks on the joining caller. More...
class  work::pool
 Persistent workers shared by independent, overlapping typed gigs. The width includes one cooperating join caller; width one needs join() to make progress. A pool must outlive every gig made from it. Callbacks should not block waiting for other pool work: join() cooperates instead. More...
class  work::context< T >
 Borrowed owner-local submissions; valid only during its handler call. Children are accepted after close(): they belong to the already accepted task. Never share this context with another thread or retain it after the callback. More...
class  work::gig< T, Handler >
 A typed, nonmovable lifetime boundary for submitted tasks and descendants. Each accepted task runs exactly once. close() is idempotent and rejects later external pushes; contexts may still create children. join() closes and waits for all descendants, publishing their writes to the caller. Destruction joins. push() and close() may race: the gig mutex determines whether push is accepted. The handler and all borrowed captures must remain valid until join returns. More...

Concepts

concept  work::task
 Tasks can move between workers without throwing.
concept  work::handler_for
 A handler consumes a task, optionally with a borrowed child-submission context.

Detailed Description

Typed gigs with private stacks and stochastic work pushing.

Definition in file work.ccm.