B4J Question MacOS - App becomes slower in the background

Blueforcer

Well-Known Member
Licensed User
Ive written an App wich makes screenshots every few ms and send it via TCP.
This works great, but only if the App stays in foreground.

If my app went to the background (another Window is in fullscreen or just completely hiding my app) after 20-30s there is a delay for 5-10s in the transmission. But as soon i move the mouse the delay is gone immediately. And if i move my applications window a little bit to one side so you can see it few millimeters beside the other apps window there is no delay the whole time.

I don't know much about macOS, but everything indicates that the operating system prioritizes hidden applications very low. Is there a way to disable this bahavior?
 

lemonisdead

Well-Known Member
Licensed User
Hello,
What you saw is true. You have to renice the background app. But I don't know if the app can send a renice <value> <PID> for itself.
Value is a positive integer
PID is the pid of your process


EDIT : renice <value> -p $(pgrep <process name>)
is nicer (source)
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Thanks this works!
But my app packed with B4J packager doesn't have the option to disable app nap. i have to disable app nap entirely. Is there a way to support this?
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Bildschirmfoto_2018_09_23_um_10_28_20.png
 
Upvote 0
Top