Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::EventFrameWake Class Reference

Coalesces event-frame requests into at most one queued frame without losing a request. More...

#include "donner/editor/FrameCallbackAdmission.h"

Public Member Functions

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.

Detailed Description

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.

Member Function Documentation

◆ 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
generationToken.

◆ finish()

bool donner::editor::EventFrameWake::finish ( uint32_t generation,
uint32_t servedSerial )
inline

Finish the frame that begin() started.

Parameters
generationFrame token.
servedSerialValue 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
generationFrame token.

◆ request()

bool donner::editor::EventFrameWake::request ( uint32_t generation)
inline

Record a request.

Parameters
generationCurrent 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: