• 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: alloc init thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alloc init thread safe?


  • Subject: Re: alloc init thread safe?
  • From: "Shawn Erickson" <email@hidden>
  • Date: Thu, 8 Mar 2007 10:06:21 -0800

On 3/8/07, David Carlisle <email@hidden> wrote:
I can't see a way around believing alloc isn't thread safe in this
case for some reason.  I've had NSZombie enabled while looking for
this bug.  I re checked my hierarchy of init methods and they are all
quite simple.  So I don't see a way that my inits could randomly
change an allocated object into a null.  The nulls make no response
at all to the messages sent to them, which was no help in finding the
problem.  I do an NSLog on the object returned from C2_alloc_init
right after the call, so nothing in the calling procedure is
affecting the result.  I'm using a core 2 duo, so both threads could
be running concurrently at that point.

I just don't understand the general principle involved so I can be
sure to avoid it in the future.

I know +[NSObject alloc] is thread safe (unless you uncovered a bug). So that leaves something in your init method or some other issue outside of the contextual information you so far have provided.

-Shawn
_______________________________________________

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: 
 >alloc init thread safe? (From: email@hidden)
 >Re: alloc init thread safe? (From: Chris Suter <email@hidden>)
 >Re: alloc init thread safe? (From: David Carlisle <email@hidden>)

  • Prev by Date: Dragging from a NSTable bound to NSArrayController
  • Next by Date: Re: alloc init thread safe?
  • Previous by thread: Re: alloc init thread safe?
  • Next by thread: Re: alloc init thread safe?
  • Index(es):
    • Date
    • Thread