Encapsulates the state of the runtime when running a single composition, including both state that is preserved across live-coding reloads and state that only lives for a single start-stop of the composition.
Definition at line 19 of file VuoRuntimeState.hh.
Public Member Functions | |
VuoRuntimeState (void) | |
Returns a partially initialized runtime instance. More... | |
~VuoRuntimeState (void) | |
Cleans up after the composition has stopped for the last time. More... | |
void | init (void *zmqContext, const char *controlUrl, const char *telemetryUrl, bool isPaused, pid_t runnerPid, int runnerPipe, bool continueIfRunnerDies, const char *workingDirectory, void *compositionBinaryHandle) |
Initializes a runtime state instance, updates its references to symbols defined in the composition binary, and opens a connection between it and the runner. More... | |
void | fini (void) |
Cleans up after the composition has stopped for a live-coding reload. More... | |
void | updateCompositionSymbols (void *compositionBinaryHandle) |
Updates references to symbols defined in the composition's generated code. More... | |
bool | isPaused (void) |
Returns true if the composition is currently paused. More... | |
bool | isStopped (void) |
Returns true if the composition hasn't started yet or has been stopped. More... | |
pid_t | getRunnerPid (void) |
Returns the process ID of the runner that started the composition. More... | |
void | disableTermination (void) |
Temporarily disables automatic termination. More... | |
void | enableTermination (void) |
Resumes automatic termination. More... | |
void | startComposition (void) |
Initializes the composition's node and port data, starts the composition's triggers firing if the composition is supposed to be unpaused initially, and starts communicating with the runner. More... | |
void | pauseComposition (void) |
Pauses firing of the composition's triggers. More... | |
void | unpauseComposition (void) |
Resumes firing of the composition's triggers. More... | |
void | stopCompositionAsOrderedByRunner (bool isBeingReplaced, int timeoutInSeconds, bool isLastEverInProcess) |
Stops the composition, either for a live-coding reload or permanently, as a result of a stop message from the runner. More... | |
void | stopCompositionAsOrderedByComposition (void) |
Nodes/libraries can call this function (via its wrapper, VuoStopComposition) to initiate a clean shutdown of the composition. More... | |
void | breakOutOfEventLoop (void) |
Carries out the final stage of stopping the composition, which entails interrupting the event loop. More... | |
Public Attributes | |
VuoRuntimePersistentState * | persistentState |
State preserved across live-coding reloads. More... | |
VuoRuntimeState::VuoRuntimeState | ( | void | ) |
Returns a partially initialized runtime instance.
VuoRuntimeState::init() should be called to finish the job.
Definition at line 27 of file VuoRuntimeState.cc.
VuoRuntimeState::~VuoRuntimeState | ( | void | ) |
Cleans up after the composition has stopped for the last time.
Definition at line 35 of file VuoRuntimeState.cc.
void VuoRuntimeState::breakOutOfEventLoop | ( | void | ) |
Carries out the final stage of stopping the composition, which entails interrupting the event loop.
AFter this function has returned, isStopped() returns true.
Definition at line 418 of file VuoRuntimeState.cc.
void VuoRuntimeState::disableTermination | ( | void | ) |
Temporarily disables automatic termination.
When a composition is asked to shut down, a watchdog timer waits a few seconds then force-quits if it hasn't cleanly shut down by then. This disables that watchdog.
Definition at line 203 of file VuoRuntimeState.cc.
void VuoRuntimeState::enableTermination | ( | void | ) |
Resumes automatic termination.
Definition at line 213 of file VuoRuntimeState.cc.
void VuoRuntimeState::fini | ( | void | ) |
Cleans up after the composition has stopped for a live-coding reload.
Definition at line 86 of file VuoRuntimeState.cc.
pid_t VuoRuntimeState::getRunnerPid | ( | void | ) |
Returns the process ID of the runner that started the composition.
Definition at line 179 of file VuoRuntimeState.cc.
void VuoRuntimeState::init | ( | void * | zmqContext, |
const char * | controlUrl, | ||
const char * | telemetryUrl, | ||
bool | isPaused, | ||
pid_t | runnerPid, | ||
int | runnerPipe, | ||
bool | continueIfRunnerDies, | ||
const char * | workingDirectory, | ||
void * | compositionBinaryHandle | ||
) |
Initializes a runtime state instance, updates its references to symbols defined in the composition binary, and opens a connection between it and the runner.
VuoException | One of the symbols was not found in the composition binary. |
Definition at line 46 of file VuoRuntimeState.cc.
bool VuoRuntimeState::isPaused | ( | void | ) |
Returns true if the composition is currently paused.
Definition at line 163 of file VuoRuntimeState.cc.
bool VuoRuntimeState::isStopped | ( | void | ) |
Returns true if the composition hasn't started yet or has been stopped.
Definition at line 171 of file VuoRuntimeState.cc.
void VuoRuntimeState::pauseComposition | ( | void | ) |
Pauses firing of the composition's triggers.
Definition at line 260 of file VuoRuntimeState.cc.
void VuoRuntimeState::startComposition | ( | void | ) |
Initializes the composition's node and port data, starts the composition's triggers firing if the composition is supposed to be unpaused initially, and starts communicating with the runner.
Definition at line 226 of file VuoRuntimeState.cc.
void VuoRuntimeState::stopCompositionAsOrderedByComposition | ( | void | ) |
Nodes/libraries can call this function (via its wrapper, VuoStopComposition) to initiate a clean shutdown of the composition.
It's also called if the VuoRunner dies, the composition is still running, and VuoRunner has requested that the composition be stopped when it dies.
Definition at line 327 of file VuoRuntimeState.cc.
void VuoRuntimeState::stopCompositionAsOrderedByRunner | ( | bool | isBeingReplaced, |
int | timeoutInSeconds, | ||
bool | isLastEverInProcess | ||
) |
Stops the composition, either for a live-coding reload or permanently, as a result of a stop message from the runner.
Definition at line 285 of file VuoRuntimeState.cc.
void VuoRuntimeState::unpauseComposition | ( | void | ) |
Resumes firing of the composition's triggers.
Definition at line 269 of file VuoRuntimeState.cc.
void VuoRuntimeState::updateCompositionSymbols | ( | void * | compositionBinaryHandle | ) |
Updates references to symbols defined in the composition's generated code.
VuoException | One of the symbols was not found in the composition binary. |
Definition at line 110 of file VuoRuntimeState.cc.
VuoRuntimePersistentState* VuoRuntimeState::persistentState |
State preserved across live-coding reloads.
Definition at line 61 of file VuoRuntimeState.hh.