Re: Mixing network code with NSThread
Re: Mixing network code with NSThread
- Subject: Re: Mixing network code with NSThread
- From: Dustin Voss <email@hidden>
- Date: Wed, 31 Jan 2007 16:41:08 -0800
On 29 Jan 2007, at 10:34 PM, R. Tyler Ballance wrote:
It almost seems _too_ easy, and I've found that when something is
as easy as it seems in threading, it's probably broken :)
IPC from the detached selector would be relatively simple posting
of NSNotifications to the main thread for handling (with retained
objects), so that's not what I'm worried about, it just seems weird
to mingle BSD socket code and NSThread together...in the same class
even!
You are right to be suspicious. You shouldn't use standard
NSNotifications for inter-thread communication. See http://
cocoadev.com/index.pl?NotificationsAcrossThreads.
That page shows a way to safely use notifications across threads, but
another good way is with the InterThreadMessaging library, which uses
Mach ports. http://cocoadev.com/index.pl?InterThreadMessaging
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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