Class Group

Class Documentation

class Group

Declaration: final

A workload handle sharing physical capacity with other groups in its pool.

Dropping a handle does not cancel accepted jobs. Close rejects new work; drain waits for accepted jobs and requires close first. No forced termination. Copies share one group. Submission/close/status are synchronized across producers; keep the physical pool alive until work settles. Same-pool drainage rejects.

Public Functions

template<typename Work>
inline std::future<std::invoke_result_t<std::decay_t<Work>&>> submit(Work &&work) const

Declaration: [[nodiscard]]

Admit an owned callable to this workload without executing it inline.

See also

Detailed guide

Template Parameters:

Work – Callable invoked without arguments; supports move-only captures and void/value/reference results.

Parameters:

work – Callable/captures retained until execution or policy failure; borrowed captures/results require independent lifetime protection.

Throws:

CE::Exceptions::failed_operation – Before acceptance when the pool expired or submissions are closed. Allocation/callable preparation can also propagate. Copies share one queue. Dropping the future/group does not cancel work. Keep the physical pool alive; do not block on same-pool jobs where capacity could be exhausted.

Returns:

Future containing the result, callback exception or native-policy failure before entry.

void close() const

Idempotently reject new group submissions without cancelling accepted jobs.

Synchronized across producers. An already destroyed pool makes this a no-op; close does not wait for completion.

See also

Detailed guide

void drain() const

Wait for accepted jobs and their captures to settle after close().

See also

Detailed guide

Throws:

CE::Exceptions::failed_operation – If the group is still open or the caller is a worker of this same pool. No forced cancellation occurs. An expired pool has already settled its accepted work; do not hold locks required by finishing jobs.

GroupStatus status() const

Declaration: [[nodiscard]]

Copy synchronized scheduler counts and cumulative failure observations.

See also

Detailed guide

Returns:

Owned snapshot, still inspectable after pool destruction; it is not an admission/completion barrier.

GroupPolicy policy() const

Declaration: [[nodiscard]]

Copy immutable policy resolved when the group was created.

See also

Detailed guide

Returns:

Requested/effective settings; later per-job policy failures are observed through status().

void report_diagnostics() const noexcept

Emit an explicit group summary and coalesced policy degradation observations.

Call outside scheduler/context/application locks and sensitive native callbacks. Callback exceptions remain future-owned; reporting failures use the emergency path.

See also

Detailed guide