On 26 Jun 08, at 23:50, Kevin Ferguson wrote:
I am not entirely sure as to what exactly a thread is, but seeing as anything I've ever programmed is light weight, I've never needed to worry before. And to be honest, such is still the case. This question is merely to satisfy my personal curiosity on the topic, and I can't seem to find a satisfactory answer through google.

Up until now, I just figured that something that wasn't thread safe would just crash if one attempted to access it from more than 1 thread. (Or it'd just give you some unexpected results) Recently, however, I read something that seemed to indicate that trying to thread a non thread safe class/method could lead to slightly worse problems than a crash. (The article in question mentioned 'damage your computer')

The author of the article in question is either using hyperbole badly, or is smoking something. Improper threading hygiene will usually cause a crash if you're lucky, and silent data corruption if you're unlucky. This corruption should be limited to your application's data, though, and it certainly won't "damage your computer" in any way!

So, when something is 'not thread safe', what exactly does it mean?

In most environments, it simply means that it cannot be shared between threads. AppKit is a bit different, though - it has a concept of a "main thread", which appears to be at least partially enforced at an operating-system level. As such, anything you see which isn't marked as thread-safe in Cocoa shouldn't be accessed from outside the main thread.

In addition, if one tries to thread a non thread safe class, what can the expected results be?

Unexpected results? :)

Could be anything, really, within certain bounds. See above.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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]

Reply via email to