Manages deferred execution of callbacks. More...
#include <DeferredDeletionQueue.h>
Public Types | |
| using | ExecutionFn = FixedFunction<void()> |
| Move-only callable representing a execution. | |
| using | PredicateFn = FixedFunction<bool()> |
| Move-only callable returning a boolean condition. | |
Public Member Functions | |
| DeferredExecutionQueue (u32 framesInFlight=3) noexcept | |
| Construct a deferred execution queue. | |
| ~DeferredExecutionQueue () noexcept | |
| Destructs the queue and flushes all pending executions. | |
| DeferredExecutionQueue (const DeferredExecutionQueue &)=delete | |
| DeferredExecutionQueue & | operator= (const DeferredExecutionQueue &)=delete |
| void | EnqueueAfterFrames (ExecutionFn fn, uint32_t delay=0) noexcept |
| Enqueue a execution to occur after delay frames. | |
| void | EnqueueWhen (PredicateFn predicate, ExecutionFn fn) noexcept |
| Enqueue a execution that occurs when a predicate returns true. | |
| void | OnFrameEnd () noexcept |
| Advance the frame counter and execute ready executions. | |
| void | Process () noexcept |
| Process only predicate-based executions. | |
| void | Flush () noexcept |
| Immediately execute all pending executions and clear the queue. | |
| u32 | FramesInFlight () const noexcept |
Manages deferred execution of callbacks.
Designed primarily for GPU resources, but can manage any deferred cleanup. Provides frame-based delays and predicate-based conditional execution.
| using Raven::DeferredExecutionQueue::ExecutionFn = FixedFunction<void()> |
Move-only callable representing a execution.
| using Raven::DeferredExecutionQueue::PredicateFn = FixedFunction<bool()> |
Move-only callable returning a boolean condition.
|
inlineexplicitnoexcept |
Construct a deferred execution queue.
| framesInFlight | Number of frames in flight to account for. |
Internally allocates a ring buffer of size framesInFlight + 1. framesInFlight must be at least 1.
|
inlinenoexcept |
Destructs the queue and flushes all pending executions.
|
delete |
|
inlinenoexcept |
Enqueue a execution to occur after delay frames.
| fn | execution callable. |
| delay | Number of frames to wait (0 -> next OnFrameEnd). |
Typically used for GPU resources to ensure they outlive all frames in flight.
|
inlinenoexcept |
Enqueue a execution that occurs when a predicate returns true.
| predicate | Condition callable, polled each frame. |
| fn | execution callable executed once predicate returns true. |
|
inlinenoexcept |
Immediately execute all pending executions and clear the queue.
Typically used at shutdown to ensure no resource leaks.
|
inlinenoexcept |
|
inlinenoexcept |
Advance the frame counter and execute ready executions.
Call once per frame at a safe point (e.g., after GPU submission). Processes frame-delayed executions and predicate-based executions.
|
delete |
|
inlinenoexcept |
Process only predicate-based executions.
Can be called independently if frame advancement is separate.