C# – Thread-safe bool properties using Locks vs Interlocked

The following bool property is not thread-safe. Why is this thread un-safe? Let’s say you have two threads running at the same time. One thread is reading the bool property, while the other thread is changing the value from false to true. It’s possible for the reader thread to get the stale value (false instead … Read more