On 5 Jul 2016, at 13:36, Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> wrote: > > This is a long shot, but I thought I would ask in case an API exists to do > what I want. One of the roles of my code is to record video to disk as it is > received from a camera. A magnetic hard disk can normally keep up with this, > but if the user is also doing other things on the computer (e.g. long file > copy in the Finder) then we are unable to keep up, and accumulate an > ever-increasing backlog of frames waiting to be saved. This eventually leads > to running out of memory, thrashing, and an unresponsive computer. Dropping > frames is not an option. In this case, the computer is a dedicated > workstation running my code, so it *is* correct for me to consider my code to > be the number 1 priority on the computer. > > What I am wondering is whether there is some way I can communicate this > requirement, to cause other apps such as the finder to get disk access at > lower priority. Or alternatively, a way that I can demand high priority > temporarily, at times when I identify that we have accumulated a save backlog?
Take a look at get/setiopolicy_np(). It isn’t clear from the documentation exactly what the default behaviour is; when I tried calling getiopolicy_np() I got IOPOL_DEFAULT, which isn’t even mentioned as a value on the man page, but you may find that setting your thread/process’s IO policy to IOPOL_IMPORTANT solves your problem. Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com