Vuo 2.4.4
Loading...
Searching...
No Matches
Functions | Variables
VuoEventLoop.m File Reference

Description

VuoEventLoop implementation.

Definition in file VuoEventLoop.m.

Go to the source code of this file.

Functions

static bool VuoEventLoop_isMainThread (void)
 Is the current thread the main thread?
 
void VuoEventLoop_processEvent (VuoEventLoopMode mode)
 Handles one or more blocks or application events (e.g., keypresses, mouse moves, window state changes).
 
void VuoEventLoop_break (void)
 Interrupts VuoEventLoop_processEvent while it is waiting.
 
void VuoEventLoop_switchToAppMode (void)
 Interrupts VuoEventLoop_processEvent if it's currently blocking, so that it can process NSEvents next time it's invoked.
 
bool VuoEventLoop_mayBeTerminated (void)
 Returns false if the app is currently waiting on user input in a modal dialog or a window sheet.
 
dispatch_queue_attr_t VuoEventLoop_getDispatchInteractiveAttribute (void)
 Returns the Dispatch attribute for QOS_CLASS_USER_INTERACTIVE.
 
void VuoEventLoop_setLimits (void)
 Increases the open-files limit, allowing each process to use (for example) more NDI connections (https://b33p.net/kosada/vuo/vuo/-/issues/18179) and more VuoRunner instances (https://b33p.net/kosada/vuo/vuo/-/issues/16635).
 
void VuoEventLoop_installSignalHandlers (void)
 Installs SIGINT and SIGTERM handlers, to cleanly shut down the composition.
 
static void VuoShowSystemPowerEvent (void *refcon, io_service_t root_domain, natural_t messageType, void *messageArgument)
 Logs changes to the system's CPU speed limit.
 
static void VuoThermalState (void)
 Log initial thermal state and state change notifications, for debugging.
 
static void VuoMemoryPressure (void)
 Log system memory pressure state change notifications, for debugging.
 
static void VuoWorkspaceState (void)
 Track workspace state changes, for debugging.
 
bool VuoEventLoop_isSystemAsleep (void)
 Returns true if the system is asleep (i.e., the screens are off but the CPU is still active).
 
void VuoEventLoop_installSleepHandlers (void)
 Starts monitoring for system sleep events, to better support maintaining a connection between VuoRunner and VuoRuntime while the system is sleeping.
 
void VuoEventLoop_disableAppNap (void)
 Disable "App Nap" since even if our timers are set to DISPATCH_TIMER_STRICT, the OS still prevents the process from running smoothly while taking a nap.
 

Variables

bool VuoEventLoop_systemAsleep = false
 True if this process has received NSWorkspaceWillSleepNotification.
 
static id * nsAppGlobal
 A pointer to the NSApp reference (NSApplication **), or NULL if there isn't one at the time this module is loaded.
 

Function Documentation

◆ VuoEventLoop_break()

void VuoEventLoop_break ( void  )

Interrupts VuoEventLoop_processEvent while it is waiting.

This function may be called from any thread.

Definition at line 122 of file VuoEventLoop.m.

◆ VuoEventLoop_disableAppNap()

void VuoEventLoop_disableAppNap ( void  )

Disable "App Nap" since even if our timers are set to DISPATCH_TIMER_STRICT, the OS still prevents the process from running smoothly while taking a nap.

https://b33p.net/kosada/node/12685

This function may only be called on the main thread.

Definition at line 402 of file VuoEventLoop.m.

◆ VuoEventLoop_getDispatchInteractiveAttribute()

dispatch_queue_attr_t VuoEventLoop_getDispatchInteractiveAttribute ( void  )

Returns the Dispatch attribute for QOS_CLASS_USER_INTERACTIVE.

Apple's documentation says: "The use of this QOS class should be limited to […] view drawing, animation, etc."

This function may be called from any thread.

Definition at line 194 of file VuoEventLoop.m.

◆ VuoEventLoop_installSignalHandlers()

void VuoEventLoop_installSignalHandlers ( void  )

Installs SIGINT and SIGTERM handlers, to cleanly shut down the composition.

This function may only be called on the main thread.

Definition at line 226 of file VuoEventLoop.m.

◆ VuoEventLoop_installSleepHandlers()

void VuoEventLoop_installSleepHandlers ( void  )

Starts monitoring for system sleep events, to better support maintaining a connection between VuoRunner and VuoRuntime while the system is sleeping.

Also starts monitoring other system/workspace events, for debugging.

This function may only be called on the main thread.

Definition at line 388 of file VuoEventLoop.m.

◆ VuoEventLoop_isMainThread()

static bool VuoEventLoop_isMainThread ( void  )
static

Is the current thread the main thread?

Definition at line 34 of file VuoEventLoop.m.

◆ VuoEventLoop_isSystemAsleep()

bool VuoEventLoop_isSystemAsleep ( void  )

Returns true if the system is asleep (i.e., the screens are off but the CPU is still active).

Definition at line 375 of file VuoEventLoop.m.

◆ VuoEventLoop_mayBeTerminated()

bool VuoEventLoop_mayBeTerminated ( void  )

Returns false if the app is currently waiting on user input in a modal dialog or a window sheet.

This function may only be called on the main thread.

Definition at line 164 of file VuoEventLoop.m.

◆ VuoEventLoop_processEvent()

void VuoEventLoop_processEvent ( VuoEventLoopMode  mode)

Handles one or more blocks or application events (e.g., keypresses, mouse moves, window state changes).

If an NSApp is available:

  • If mode is VuoEventLoop_WaitIndefinitely, waits until an NSEvent arrives, processes the event, and returns.
  • If mode is VuoEventLoop_RunOnce, processes an NSEvent (if one is ready), and returns.

If there's no NSApp, executes the CFRunLoop:

  • If mode is VuoEventLoop_WaitIndefinitely, returns when the CFRunLoop exits.
  • If mode is VuoEventLoop_RunOnce, returns immediately after a single CFRunLoop iteration.

In either case, when mode is VuoEventLoop_WaitIndefinitely, VuoEventLoop_break will cause this function to return immediately.

This function may only be called on the main thread.

Definition at line 78 of file VuoEventLoop.m.

◆ VuoEventLoop_setLimits()

void VuoEventLoop_setLimits ( void  )

Increases the open-files limit, allowing each process to use (for example) more NDI connections (https://b33p.net/kosada/vuo/vuo/-/issues/18179) and more VuoRunner instances (https://b33p.net/kosada/vuo/vuo/-/issues/16635).

This function may only be called on the main thread.

Definition at line 211 of file VuoEventLoop.m.

◆ VuoEventLoop_switchToAppMode()

void VuoEventLoop_switchToAppMode ( void  )

Interrupts VuoEventLoop_processEvent if it's currently blocking, so that it can process NSEvents next time it's invoked.

This function may be called from any thread.

Definition at line 152 of file VuoEventLoop.m.

◆ VuoMemoryPressure()

static void VuoMemoryPressure ( void  )
static

Log system memory pressure state change notifications, for debugging.

Eventually we could use these to adapt cache usage.

Definition at line 323 of file VuoEventLoop.m.

◆ VuoShowSystemPowerEvent()

static void VuoShowSystemPowerEvent ( void *  refcon,
io_service_t  root_domain,
natural_t  messageType,
void *  messageArgument 
)
static

Logs changes to the system's CPU speed limit.

Definition at line 262 of file VuoEventLoop.m.

◆ VuoThermalState()

static void VuoThermalState ( void  )
static

Log initial thermal state and state change notifications, for debugging.

Eventually we could use these to adapt graphics quality.

Definition at line 282 of file VuoEventLoop.m.

◆ VuoWorkspaceState()

static void VuoWorkspaceState ( void  )
static

Track workspace state changes, for debugging.

Definition at line 341 of file VuoEventLoop.m.

Variable Documentation

◆ nsAppGlobal

id* nsAppGlobal
static

A pointer to the NSApp reference (NSApplication **), or NULL if there isn't one at the time this module is loaded.

Definition at line 24 of file VuoEventLoop.m.

◆ VuoEventLoop_systemAsleep

bool VuoEventLoop_systemAsleep = false

True if this process has received NSWorkspaceWillSleepNotification.

Definition at line 22 of file VuoEventLoop.m.