不轮询观察进程生命周期很慢?

发布于 2024-12-14 23:54:21 字数 219 浏览 3 评论 0原文

我使用了苹果描述的一种技术无需轮询即可观察进程生命周期 观察任意过程。

我使用了那里提到的确切源代码以及所有三种技术。但响应速度很慢,有时甚至不起作用。

文档中是否缺少任何内容?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长伴 2024-12-21 23:54:21

啊……你给了我我正在寻找的关键字。您想要监控进程,而不是应用程序。如果您尝试捕获除常规 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文