OS X 10.9 & App Nap

Mac OSX specific forum
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: OS X 10.9 & App Nap

Post by J. Baker »

I tried that a when Danilo posted it but it didn't work for me for some reason. Glad it worked for you guys. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: OS X 10.9 & App Nap

Post by Danilo »

@J.Baker:
Could it have something to do with the flags you use? ( #NSActivityBackground or #NSActivityUserInitiated or ... )
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: OS X 10.9 & App Nap

Post by J. Baker »

Danilo wrote:@J.Baker:
Could it have something to do with the flags you use? ( #NSActivityBackground or #NSActivityUserInitiated or ... )
If I remember correctly, I tried all possible flags. I'm not sure why it didn't work for me but I can try it again sometime soon.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
spacebuddy
Enthusiast
Enthusiast
Posts: 364
Joined: Thu Jul 02, 2009 5:42 am

Re: OS X 10.9 & App Nap

Post by spacebuddy »

J. Baker,

Yes, use those two variables. You need to call this in your thread or a timer and it should work :D

I tested in Maverick and Yosemite and it works.

I think App Nap kicks in when the CPU goes to 0 for a little bit. What you can try is setup a timer (1000 ms) which will ramp the CPU
up to like 0.3 which should stop App Nap. I have not tested this, but it should work. :lol:

Nevermind, I just tried that and it does not work.

Here is the code I use to stop App Nap.

NSProcessInfo = CocoaMessage(0,0,"NSProcessInfo processInfo")
If NSProcessInfo
Value=#NSActivityUserInitiated ! #NSActivityLatencyCritical
EndIf

CocoaMessage(0,NSProcessInfo,"beginActivityWithOptions:@",@Value,"reason:$",@"block")
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: OS X 10.9 & App Nap

Post by J. Baker »

Thanks and will try again. My app was using roughly 7-10% cpu when I first tried it but app nap still kicked in. Mavericks has been updated since then though, so maybe it will work now.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply