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

Re: Objects between threads


  • Subject: Re: Objects between threads
  • From: Chris Ross <email@hidden>
  • Date: Sat, 7 Sep 2002 16:37:53 +0100

Yes, I have an NSLock that locks on addition of something to the mutable
array and also when going through the array.

I also added a 'retain' call and this still causes things to fail.

i am really baffled by this,

Regards,

Chris

On Saturday, September 7, 2002, at 04:28 pm, Nathan Day wrote:

You don't mention the use of NSLock, NSMutableArray's are not thread safe so you need to restrict access to your array to one thread at a time using NSLock.

On Sunday, September 8, 2002, at 12:17 AM, Chris Ross wrote:

I have a problem. I have a class that can connect to a data source.

I wish to loop around and go through an array of the data source
objects checking to see if there is any data, and if so process it.

If I create an object and add it to an array from an outside thread,
then the program segfaults when I try and access the object, and
it's methods. If I create the object within the thread and add it to
the same array, everything works fine. The array is created out
side the threads execution pool.

Any ideas on how to get this to work ? I am using a thread so that
data processing can occur outside the main application loop.

I guess that it has something to do with memory pools but I dont
know, I am too new at this,

Nathan Day
http://homepage.mac.com/nathan_day/

_______________________________________________
MacOSX-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/macosx-dev

--
Chris Ross - email@hidden - http://www.darkrock.co.uk
Ferite Programming Language - http://www.ferite.org
_______________________________________________
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.

  • Follow-Ups:
    • Re: Objects between threads
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Objects between threads (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Objects between threads
  • Next by Date: Re: Objects between threads
  • Previous by thread: Re: Objects between threads
  • Next by thread: Re: Objects between threads
  • Index(es):
    • Date
    • Thread