Re: alloc init thread safe?
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