NSNotificationCenter线程是否安全? [英] Is NSNotificationCenter thread safe?

查看:169
本文介绍了NSNotificationCenter线程是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在特定队列中发布通知,并在另一个队列中接收通知吗?我想使用通知来沟通不同的队列,但我不知道这是否安全...

Can I post a notification in a given queue and receive it on another? I want to use notifications to communicate different queues, but I'm not sure if this is safe...

推荐答案

否。通知在与它们发送的相同的线程中传递,这将需要重新发送它以某种方式获得通知到您的线程。

No. Notifications are delivered in the same thread that they are sent from, this you will need to re-send it in some way to get the notification to your thread.

这篇关于NSNotificationCenter线程是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆