• 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: Sharing objects between threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sharing objects between threads


  • Subject: Re: Sharing objects between threads
  • From: 陳銘崧(James Chen) <email@hidden>
  • Date: Fri, 25 Jun 2004 17:14:14 +0800

Hi,
I guess the contents of the array are NSDistantObject before you detach the thread.
Because I use thread with parameter and it never did that for me, unless I form my connection and pass parameter(array) via that connection.

Are those objects within the array are vended by connection?
If so, you have to send -enableMultipleThreads to that connection.
Or you have to form the connection for each thread respectively.

HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Jun 25, 2004, at 12:15 PM, Mike O'Connor wrote:

I have several objects I want to share between two threads. Locking is not the problem, rather I keep running into "NSDistantObject access attempted from another thread" errors.

I have some objects (classes) I've created, and I place them into an NSArray. Then I pass that array as the withObject argument to detachNewThreadSelector.

My thread gets the array ok, but when I try to use one of the objects [myObjectFromArray message], I get the distant object error.

What's the proper way to share several objects between threads? Can't I just move the id across somehow and use it, since it's all in the same app, without it changing into a distant object?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Sharing objects between threads (From: "Mike O'Connor" <email@hidden>)

  • Prev by Date: Re: Data source management in NSOutlineView
  • Next by Date: Re: figuring out the length of a string
  • Previous by thread: Sharing objects between threads
  • Next by thread: Re: Sharing objects between threads
  • Index(es):
    • Date
    • Thread