What is the purpose of interlocked class in .NET?Interlocked
class belongs to System.Threading namespace. When two threads try to update
same variables or when two threads are concurrently executing there are
chances of many error occurrences and incorrect data updation.
In those situations, interlocked class and its methods are very helpful to manipulate on variables accessible by one or more threads without throwing any error or exception. Methods provided by interlocked class are listed below: Increment
- Used to increment a variables value and store its result. Int32
and Int64 integers are its legal parameters.
|