AppKit 是否线程安全?
你能解释一下 AppKit 是否线程安全吗?我在哪里可以读到相关内容? (线程编程指南除外,因为本文档创建了更多问题而不是答案)。例如,我可以在单独的线程中验证 NSToolbar 的VisibleItems 吗?或者我可以在第二个线程中增加 NSProgressIndicator 的值吗?
Can you explain me is AppKit thread-safe or not? Where can I read about it? (Except Threaded Programming Guide because this documentation creates more question instead answers). For example can I validateVisibleItems of NSToolbar in separated thread? Or can I increment value of NSProgressIndicator in second thread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这不是一般情况。您 不应向除主线程之外的任何 UI 对象发送消息。
在您给出的具体示例中,您可以使用 performSelectorOnMainThread:withObject:waitUntilDone: 到绕过限制:
No, it is not in general. You should not send messages to any UI objects except from the main thread.
In the specific example you give, you can use performSelectorOnMainThread:withObject:waitUntilDone: to get around the restriction: