Hi,
I have a C++ application connected to a specific socket. The problem is that when the application is not in use, macOS idle wakeups become very low.
I am quite new in Apple development but as I understand applications get low priority when the idle wakeups are low. Therefore, application only wakes up when the set period of time (say a few seconds) is reached and it does not respond to requests immediately. To improve performance, I am trying to implement an event listening mechanism in the application that would be triggered by socket activity.
In the documentation, there is some information on network events (see Table 7.1): https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/Timers.html
I guess every messaging app is implementing a similar mechanism i.e. rather than waiting for the idle wakeup period to wake the application, an event is triggered when user data arrives at the socket application is connected to.
My questions are
- Is my understanding of idle wakeups mechanism correct?
- What options are available to solve this problem and improve app performance i.e. response time?
- Are there any sample code snippets showing how to register that kind of a network event listener?
Many thanks