Re: sleep wake without runloop

Chris Hanson

Create your own thread and give it a run loop, then use IORegisterForSystemPower on that run loop.

-- Chris

On Nov 23, 2017, at 1:45 AM, Gerriet M. Denkmann <g@...> wrote:

macOS 13.1

Is there a way to ascertain whether a process is sleeping or awake?

There is IORegisterForSystemPower which sends seep/wake notifications but needs a runloop.

Anything else?

Background: I want to modify chronyd, a LaunchDaemon, which being multi-platform does not have a runloop.
The problem: between NSWorkspaceWillSleepNotification and NSWorkspaceDidWakeNotification this (as any app) will be active from time to time (every few minutes it will be active for almost a minute), which messes up the internals of chronyd.


Join to automatically receive all group messages.