Coalesces event-frame requests into at most one queued frame without losing a request.
More...
#include "donner/editor/FrameCallbackAdmission.h"
|
|
uint32_t | start () |
| | Start a new generation, discarding any queued frame of an earlier one.
|
|
void | stop () |
| | Reject every queued and future frame until the next start().
|
|
uint32_t | generation () const |
| | Current generation, or zero after shutdown.
|
| bool | isCurrent (uint32_t generation) const |
| | Whether a frame token still belongs to this generation.
|
| bool | request (uint32_t generation) |
| | Record a request.
|
| uint32_t | begin () const |
| | Read when the queued frame starts.
|
| bool | finish (uint32_t generation, uint32_t servedSerial) |
| | Finish the frame that begin() started.
|
| void | cancel (uint32_t generation) |
| | Release a frame that will not run: a stale token or a failed post.
|
Coalesces event-frame requests into at most one queued frame without losing a request.
A request that lands before the queued frame starts is served by that frame. A request that lands while the frame runs, including one whose admission attempt loses to the frame still being pending, makes finish() ask for one more frame. Requests may come from any thread; begin() and finish() belong to the thread that runs the frame. The serial and the admission flag are sequentially consistent: a requester that loses the admission race and a finisher that rechecks the serial cannot both miss each other's update.
◆ begin()
| uint32_t donner::editor::EventFrameWake::begin |
( |
| ) |
const |
|
inline |
Read when the queued frame starts.
- Returns
- The request serial this frame serves.
◆ cancel()
| void donner::editor::EventFrameWake::cancel |
( |
uint32_t | generation | ) |
|
|
inline |
Release a frame that will not run: a stale token or a failed post.
- Parameters
-
◆ finish()
| bool donner::editor::EventFrameWake::finish |
( |
uint32_t | generation, |
|
|
uint32_t | servedSerial ) |
|
inline |
Finish the frame that begin() started.
- Parameters
-
| generation | Frame token. |
| servedSerial | Value begin() returned. |
- Returns
- true when the caller must queue another frame for requests it did not serve.
◆ isCurrent()
| bool donner::editor::EventFrameWake::isCurrent |
( |
uint32_t | generation | ) |
const |
|
inline |
Whether a frame token still belongs to this generation.
- Parameters
-
◆ request()
| bool donner::editor::EventFrameWake::request |
( |
uint32_t | generation | ) |
|
|
inline |
Record a request.
- Parameters
-
| generation | Current generation. |
- Returns
- true when the caller must queue the event frame; false when one is already owed.
The documentation for this class was generated from the following file: