Ning Su Ning Su - 1 year ago 90
iOS Question

Notifications in Multiple Thread iOS

I have found that when I want to deliver Notifications to particular threads, there is a sample from Apple.

In this article, Apple suggests that using a machport to monitor the thread which we want to process the notification.

- (void)processNotification:(NSNotification *)notification {

if ([NSThread currentThread] != notificationThread) {
// Forward the notification to the correct thread.
[self.notificationLock lock];
[self.notifications addObject:notification];
[self.notificationLock unlock];
[self.notificationPort sendBeforeDate:[NSDate date]
else {
// Process the notification here;

My question is: if I get the notification and I use
to process the notification, does it has a different appearance?

dispatch_async(dispatch_get_main_queue(), ^{
// Process the notification here;

Answer Source

the simple answer is : no difference

I also noticed the apple suggested link is Updated: 2009-08-18. it seems to already outdated. GCD is a more powerful and convenient way to achieve multi-thread work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download