Search code examples
objective-cmacoscocoaprocessnsworkspace

Observing Process Lifetimes Without Polling is very slow?


I was using a technique described by apple for Observing Process Lifetimes Without Polling to Observe Arbitrary Processes.

I used exact source code mentioned there and with all three techniques. But the response is very slow and sometimes even does not work.

Is there anything missing in documentation?


Solution

  • Ahhhh... you gave me the keyword I was looking for. You want to monitor processes, not apps. You can't use the NSWorkspace solution if you are trying to catch non-AppKit apps or command line processes in addition to regular Macintosh apps.

    Try focusing on the kqueue solution.

    And if that isn't good, look at "The Service-Oriented Alternative" section in your Apple Tech Note. If you rethink your approach a bit, you might be able to use launchd to accomplish what you're trying to do.