不轮询观察进程生命周期很慢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊……你给了我我正在寻找的关键字。您想要监控进程,而不是应用程序。如果您尝试捕获除常规 Macintosh 应用程序之外的非 AppKit 应用程序或命令行进程,则无法使用 NSWorkspace 解决方案。
尝试关注 kqueue 解决方案。
如果这不好,请查看 Apple 技术说明中的“面向服务的替代方案”部分。如果您重新考虑一下您的方法,您也许可以使用 launchd 来完成您想要做的事情。
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.