Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Define Thread Safe
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01367996
Message ID:
01368092
Views:
7
>What does 'Thread Safe' mean? Google search didn't turn up much in the way of explanations.

It just basically means that the code will work in a multi-threaded environment and still function correctly. A lot of code isn't thread safe - imagine any code that sets a property through a method in an instance of a class. For example, if you had a loop which incremented a counter and the counter was a property. While that code is running another thread calls the same method and begins incrementing the same counter; it's pretty safe to assume your code will no longer behave correctly since you now have different threads messing with the same variable (property) at the same time. This code isn't threadsafe. Threadsafe code would ensure that multiple processes couldn't interact in bad ways (usually through some sort of locking, copying the property to a local var, etc.)
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform