Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Define Thread Safe
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01367996
Message ID:
01368092
Vues:
8
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform