work 0.1.0
A gig is a bunch of related work. The pool does the work.
Loading...
Searching...
No Matches
work::gig< T, Handler > Class Template Referenceexport
module work

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...

Public Member Functions

void push (T value)
 Submit external work. Throws logic_error if close() won the race.
void push (std::span< T const > values)
 Submit a copied batch under one admission lock.
void close () noexcept
 Stop external submissions. Already accepted descendants still run.
void join () noexcept
 Close and cooperatively await completion. Repeated joins are harmless.
 ~gig () noexcept
 Close and join before releasing handler and task storage.

Detailed Description

template<task T, class Handler>
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.

Definition at line 263 of file work.ccm.

Member Function Documentation

◆ join()

template<task T, class Handler>
void work::gig< T, Handler >::join ( )
inlinenoexcept

Close and cooperatively await completion. Repeated joins are harmless.

Precondition
Do not join this gig from its own callback or a callback nested inside it.

Definition at line 324 of file work.ccm.


The documentation for this class was generated from the following file: