Re: Need some advice on multithreading
Re: Need some advice on multithreading
- Subject: Re: Need some advice on multithreading
- From: "Adam R. Maxwell" <email@hidden>
- Date: Mon, 24 Nov 2008 07:00:17 -0800
On Nov 24, 2008, at 2:27 AM, Jens Miltner wrote:
Am 24.11.2008 um 11:08 schrieb WT:
>And to answer one question you asked inline, NSNotificationCenter
>delivers all notifications synchronously and immediately on the
thread
>on which they were sent. It is really just a way of indirectly
>invoking methods, it doesn't know or care about threads at all.
Ok, now, that's something I didn't know and which is very useful to
know. Thanks!
There's also NSNotificationQueue, which you could use to distribute
notifications to another thread.
Only if you write your own, since NSNotificationQueue is not thread
safe [1] and does not pass notifications to another thread.
NSDistributedNotificationCenter always posts notifications on the main
thread, but it's not intended for interthread messaging.
Apple has a document describing how to pass notifications between
threads [2], but I've had a doc bug open against it for most of this
year (rdar://problem/5772256) since it may be unsafe.
--
Adam
[1] http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/chapter_950_section_2.html
[2] http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/Notifications/Articles/Threading.html
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden