Re: Obj-C runtime not thread-safe?!
Re: Obj-C runtime not thread-safe?!
- Subject: Re: Obj-C runtime not thread-safe?!
- From: Marcel Weiher <email@hidden>
- Date: Sat, 19 Jun 2004 16:40:16 +0100
On 18 Jun 2004, at 10:24, Charles Srstka wrote:
I have written a little sample program that will demonstrate this. Of
course, if you run it normally, the Thing class will initialize almost
instantly and the problem will not occur. But, at least on my G4/450
DP, running this in the debugger slows it down enough to make this
problem occur. Uncomment the first NSLog in Thing.m to see that one of
the threads isn't getting the class object.
Hmm...I can't reproduce this even in the debugger, but my machine is
faster. However, it seems more likely that NSLog() isn't thread-safe.
Have you tried something other than NSLog?
- (void)doSomethingInNewThread {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//NSLog(@"Thing class is %@",[Thing class]);
Thing *thing = [Thing thing];
NSLog(@"thing is %@",thing);
[pool release];
}
_______________________________________________
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.