#include <runloop.h>
Run loop interface. Use this interface to implement an application UI event run loop. Usually there already is a default implementation, but there might be cases where different UI toolkits are available for a system. Depending on the project's requirements the adequate one can be selected (via command line or project option). Only one run loop will be active for the run time of an application.
Public Types | |
using | TimerCallback = void(*)(void *self) |
Public Member Functions | |
MAXON_OBSERVABLE_STATIC (Result< void >, ObservableExitLoop,(), ObservableCombinerRunAllAggregateErrorsComponent) | |
MAXON_OBSERVABLE_STATIC (Result< void >, ObservableActivationChange,(Bool becomesActive), ObservableCombinerRunAllAggregateErrorsComponent) | |
MAXON_OBSERVABLE_STATIC (Bool, ObservableRunLoopMessage,(const void *message), ObservableCombinerRunAllBoolUntilTrue) | |
Static Public Member Functions | |
static MAXON_METHOD Result< void > | EnterLoop (Bool isInternalLoop=true) |
static MAXON_METHOD Result< void > | EnterLoop (Bool isInternalLoop, void *osSpecific) |
static MAXON_METHOD void | ExitLoop () |
static MAXON_METHOD void | TriggerMainThreadQueue () |
static MAXON_METHOD Result< Timer * > | AddTimer (TimeValue interval, TimeValue delay, TimeValue tolerance, TimerCallback callback, void *self) |
static MAXON_METHOD void | RemoveTimer (Timer *timer) |
static MAXON_METHOD void | GetLinuxDefaultDisplayAndScreen (void *&display, int &screen) |
static MAXON_METHOD void ** | PrivateGetMainThreadQueueTrigger () |
static MAXON_METHOD void | PrivateSetWaitInterval (TimeValue waitInterval) |
static MAXON_METHOD void | PrivateSetDefaultDisplayAndScreen (void *display, int screen) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (RunLoop, MAXON_REFERENCE_NONE, "net.maxon.interface.runloop") | |
using TimerCallback = void (*)(void* self) |
|
private |
|
static |
Enters the main thread run loop. Returns IllegalArgumentError if there's no run loop. Errors returned by subscribers to ObservableExitLoop() will be returned as AggregatedError.
[in] | isInternalLoop | True by default, false if the method is to return immediately after initialization because the main thread is driven by a different host. |
|
static |
Enters the main thread run loop. Returns IllegalArgumentError if there's no run loop. Errors returned by subscribers to ObservableExitLoop() will be returned as AggregatedError.
[in] | isInternalLoop | True by default, false if the method is to return immediately after initialization because the main thread is driven by a different host. |
[in] | osSpecific | An OS-specific parameter, nullptr by default. |
|
static |
Asks the main thread run loop to exit. THREADSAFE.
|
static |
Notifies the main thread event loop that it should execute jobs. THREADSAFE.
|
static |
Schedules a job to be called periodically at the specified interval on the main thread. If the interval is 0.0 the timer is fired once after the specified delay. For each AddTimer() call you must call RemoveTimer() to remove it. Otherwise the timer runs forever or (for a one-shot timer) at least its memory will leak. If the run loop does not support timers a nullptr is returned (this is not an error). In this case the timer implementation has to enqueue jobs on the main thread (which is less efficient but works).
[in] | interval | Timer interval. |
[in] | delay | Delay until the timer fires the first time. |
[in] | tolerance | Maximum tolerance of execution (used for timer coalescing). |
[in] | callback | To be called by the timer (periodically). |
[in] | self | Pointer to callback data. |
|
static |
Removes a timer created with AddTimer.
[in] | timer | Timer interval. |
|
static |
Returns the default display for the Linux runloop.
[out] | display | A reference which will hold the display pointer. The pointer can be cast to Display. |
[out] | screen | The screen. |
MAXON_OBSERVABLE_STATIC | ( | Result< void > | , |
ObservableExitLoop | , | ||
() | , | ||
ObservableCombinerRunAllAggregateErrorsComponent | |||
) |
Notifies the observers that the run loop will exit.
MAXON_OBSERVABLE_STATIC | ( | Result< void > | , |
ObservableActivationChange | , | ||
(Bool becomesActive) | , | ||
ObservableCombinerRunAllAggregateErrorsComponent | |||
) |
Notifies the observers that the application changes from active to inactive.
MAXON_OBSERVABLE_STATIC | ( | Bool | , |
ObservableRunLoopMessage | , | ||
(const void *message) | , | ||
ObservableCombinerRunAllBoolUntilTrue | |||
) |
Invokes the observer(s) with a pointer to the current event. The observer might return true if it already handled the event and it should be discarded.
|
static |
|
static |
|
static |