Hey guys, hopefully someone who knows what may be going under the pthread/NSThread hood when GC is enabled can solve this little mystery...
Pretty straightforward situation: I have a 64 bit Cocoa app (and screen saver) that uses pthreads (via the pthread API, *not* NSThread). To be compatible with GC with IAW with Apple's GC Programming Guide (quote below), I make a call to [NSThread currentThread] when a new thread starts so that it gets registered with the GC subsystem. Per Apple GC Programming Guide (page 15): // SNIP // Garbage collection is performed on its own thread--a thread is explicitly registered with the collector if it calls NSThread's currentThread method (or if it uses an autorelease pool). There is no other explicit API for registering a pthread with the collector. // SNIP // However when my bundle runs under as a 64 bit GC app or a 64 bit screen saver (via the sys prefs app), the following log msg shows up for each call to [NSThread currentThread] I make when the thread first starts: [0x0-0x8b08b0].com.apple.systempreferences[1198] System Preferences(1198,0x11a8f9000) malloc: *** auto malloc[1198]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug. As the message directs, I set that breakpoint, and I see the following stack inside of the [NSThread currentThread] call: #0 0x7fff81b08c64 in auto_zone_thread_registration_error #1 0x7fff81b089aa in Auto::Zone::registered_thread #2 0x7fff81b01df0 in auto_zone_allocate_object #3 0x7fff85c8602a in _internal_class_createInstanceFromZone #4 0x7fff866d56e9 in +[NSObject(NSObject) allocWithZone:] #5 0x7fff866d5671 in +[NSObject(NSObject) new] #6 0x7fff88e553b5 in _NSThreadGet0 So, it seems like I'm following the spec yet I can't seem to shake that error message. Anyone on the inside care to illuminate what's happening here? Apart from those [NSThread currentThread] calls I make when the pthread first starts, is there something else I need to call that the GC spec doesn't discuss? Thanks in advance! Andy _______________________________________________ Cocoa-dev mailing list ([email protected]) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
