Class FinalizeJob

Class Documentation

class FinalizeJob

Awaiter for finalizing a Job when it completes.

Returned by JobPromise::final_suspend(), this awaiter handles cleanup when a job reaches its end (via co_return). It decrements the associated Counter (if any), notifies waiting threads, and returns the continuation handle to resume the caller.

This enables automatic parent-job resumption in nested job scenarios: when a child job completes, the parent that co_awaited it automatically resumes.

Public Functions

inline constexpr bool await_ready() noexcept
std::coroutine_handle await_suspend(std::coroutine_handle<> handle) noexcept

Finalizes the job and returns continuation to resume.

Parameters:

handle – The completing job’s coroutine handle

Returns:

Continuation handle (parent job or noop_coroutine)

inline void await_resume() noexcept