Vuo  2.3.2
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? More...
 
void VuoEventLoop_processEvent (VuoEventLoopMode mode)
 Handles one or more blocks or application events (e.g., keypresses, mouse moves, window state changes). More...
 
void VuoEventLoop_break (void)
 Interrupts VuoEventLoop_processEvent while it is waiting. More...
 
void VuoEventLoop_switchToAppMode (void)
 Interrupts VuoEventLoop_processEvent if it's currently blocking, so that it can process NSEvents next time it's invoked. More...
 
bool VuoEventLoop_mayBeTerminated (void)
 Returns false if the app is currently waiting on user input in a modal dialog or a window sheet. More...
 
dispatch_queue_attr_t VuoEventLoop_getDispatchInteractiveAttribute (void)
 Returns the Dispatch attribute for QOS_CLASS_USER_INTERACTIVE. More...
 
void VuoEventLoop_setLimits (void)
 Installs SIGINT and SIGTERM handlers, to cleanly shut down the composition. More...
 
void VuoEventLoop_installSignalHandlers (void)
 Installs SIGINT and SIGTERM handlers, to cleanly shut down the composition. More...
 
static void VuoShowSystemPowerEvent (void *refcon, io_service_t root_domain, natural_t messageType, void *messageArgument)
 Logs changes to the system's CPU speed limit. More...
 
static void VuoThermalState (void)
 Log initial thermal state and state change notifications, for debugging. More...
 
static void VuoMemoryPressure (void)
 Log system memory pressure state change notifications, for debugging. More...
 
static void VuoWorkspaceState (void)
 Track workspace state changes, for debugging. More...
 
bool VuoEventLoop_isSystemAsleep (void)
 Returns true if the system is asleep (i.e., the screens are off but the CPU is still active). More...
 
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. More...
 
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. More...
 

Variables

bool VuoEventLoop_systemAsleep = false
 True if this process has received NSWorkspaceWillSleepNotification. More...
 

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 118 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 401 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 195 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 225 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 387 of file VuoEventLoop.m.

◆ VuoEventLoop_isMainThread()

static bool VuoEventLoop_isMainThread ( void  )
static

Is the current thread the main thread?

Definition at line 27 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 374 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 163 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 71 of file VuoEventLoop.m.

◆ VuoEventLoop_setLimits()

void VuoEventLoop_setLimits ( 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 210 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 151 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 322 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 261 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 281 of file VuoEventLoop.m.

◆ VuoWorkspaceState()

static void VuoWorkspaceState ( void  )
static

Track workspace state changes, for debugging.

Definition at line 340 of file VuoEventLoop.m.

Variable Documentation

◆ VuoEventLoop_systemAsleep

bool VuoEventLoop_systemAsleep = false

True if this process has received NSWorkspaceWillSleepNotification.

Definition at line 22 of file VuoEventLoop.m.