• 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: NSConnection; serving a class in-process / crossing thread boundary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSConnection; serving a class in-process / crossing thread boundary


  • Subject: Re: NSConnection; serving a class in-process / crossing thread boundary
  • From: Adam Leonard <email@hidden>
  • Date: Mon, 20 Mar 2006 17:31:14 -0800

NSConnection does support doing this, it just isn't enabled by default. See: <http://developer.apple.com/documentation/Cocoa/ Reference/Foundation/ObjC_classic/Classes/NSConnection.html#// apple_ref/occ/instm/NSConnection/enableMultipleThreads>

However, I am not sure you are designing your threads the best way. If I understand what you are doing, you have the GUI thread spawn a thread that spawns another thread to do the work so the GUI thread isn't blocked when doing performing a method through the distant object.
Have you just tried making these long methods return "oneway void". That way, they will return immediately and the GUI will not be blocked. See: <http://developer.apple.com/documentation/Cocoa/ Conceptual/ObjectiveC/Articles/chapter_5_section_6.html>


Hope that helps
Adam Leonard


My problem is, that as soon as I access properties on an NSDistantObject
that represents a method parameter - for example, the name of the volume
to mount, the runtime throws an exception telling me that something
similar to the following:
'NSDistantObject can't be accessed from another thread'.


So this means, that when I provide a 'service' via the NSConnection
mechanism - even if it's intra-process, I must do *ALL* processing on a
single thread within the so-called 'server'? Yikes!


Can I get around this somehow? I'd like to maintain simplicity in the
GUI, so that in the GUI there's no issues about having to marshall stuff
onto the main GUI thread.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSConnection; serving a class in-process / crossing thread boundary (From: email@hidden)

  • Prev by Date: Re: Threading and NSViews
  • Next by Date: Re: Magic key for IB palettes?
  • Previous by thread: NSConnection; serving a class in-process / crossing thread boundary
  • Next by thread: Crash in NSOpenPanel
  • Index(es):
    • Date
    • Thread