• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mixing network code with NSThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Mixing network code with NSThread (From: "R. Tyler Ballance" <email@hidden>)

  • Prev by Date: Re: Is the "id" type an immovable pointer? Or a movable handle
  • Next by Date: Re: NSButton Text Color?
  • Previous by thread: Re: Mixing network code with NSThread
  • Next by thread: How to clear text of an NSTextView
  • Index(es):
    • Date
    • Thread