tess
1.0.0
Performance-first tile and path simulation substrate
Toggle main menu visibility
Loading...
Searching...
No Matches
async_work_task.h
1
#pragma once
2
3
#include <tess/ops/async_work.h>
4
#include <tess/sim/schedule.h>
5
6
namespace
tess {
7
13
template
<
typename
T>
14
class
ResumableWorkTask {
15
public
:
16
explicit
ResumableWorkTask(
ResumableWorkQueue<T>
& queue) noexcept
17
: queue_(&queue) {}
18
19
ResumableWorkTask(
const
ResumableWorkTask&) =
delete
;
20
auto
operator=(
const
ResumableWorkTask&) -> ResumableWorkTask& =
delete
;
21
ResumableWorkTask(ResumableWorkTask&&) =
delete
;
22
auto
operator=(ResumableWorkTask&&) -> ResumableWorkTask& =
delete
;
23
24
[[nodiscard]]
auto
operator()(
const
ScheduleTaskContext
& context)
25
->
ScheduleTaskResult
{
26
const
auto
stats = queue_->advance(
AsyncWorkBudget
{context.budget_items});
27
return
ScheduleTaskResult
{{}, stats.items_done, stats.pending != 0, 0};
28
}
29
30
private
:
31
ResumableWorkQueue<T>
* queue_ =
nullptr
;
32
};
33
34
}
// namespace tess
tess::ResumableWorkQueue
Definition
async_work.h:107
tess::AsyncWorkBudget
Deterministic item allowance shared by one queue advance.
Definition
async_work.h:50
tess::ScheduleTaskContext
Supplies a task with the current tick, trigger bits, and work allowance.
Definition
schedule.h:122
tess::ScheduleTaskResult
Returns produced dirty bits and bounded background progress to the schedule.
Definition
schedule.h:136
include
tess
sim
async_work_task.h
Generated by
1.17.0