Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: observing dealloc



Your posted code is completely not thread safe. Every single method is a threading disaster waiting to happen.

Here is a hint: If you use the words "global" or "static" or "shared", you are going to need some form of concurrent access protection (a mutex, semaphore, etc.).

Just scanning your code, I note that there are no bottle necks through which gGlobals and gCounters are accessed. That is bad form in any case, but if you seriously contemplate multi-threading, you are frankly in deep trouble.

What are you really trying to accomplish? "add globals to any class" is a very strange goal. Why would you want to add "globals" to any class; that doesn't even make any sense? Is English your first language ? Do you really mean "have global instances of any class" ? Has anyone ever suggested to you that using globals might not be the best approach ?

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.