Class JobBase

Inheritance Relationships

Derived Types

Class Documentation

class JobBase

Base class for Job<T> providing type-erased job handle.

Move-only. Jobs must be dispatched to scheduler before destruction.

Subclassed by portal::Job< Result >, portal::Job< void >

Public Types

using handle_type = std::coroutine_handle<JobPromise>

Public Functions

inline JobBase(const handle_type handle)
JobBase(const JobBase&) = delete
inline JobBase(JobBase &&other) noexcept
JobBase &operator=(const JobBase&) = delete
inline JobBase &operator=(JobBase &&other) noexcept
inline virtual ~JobBase()
inline auto operator co_await() noexcept
void set_dispatched()

Mark job as dispatched to scheduler (prevents double-free on destruction).

void set_scheduler(jobs::Scheduler *scheduler_ptr) const noexcept

Set the scheduler for this job.

Parameters:

scheduler_ptr – Pointer to the owning scheduler

void set_counter(jobs::Counter *counter_ptr) const noexcept

Set the counter to decrement on completion.

Parameters:

counter_ptr – Pointer to the synchronization counter

inline bool is_dispatched() const noexcept
inline bool is_completed() const noexcept

Public Members

handle_type handle

Protected Attributes

bool dispatched = false
bool owning_result = false