Shared enum between multiple threads
问题 I have an enumeration that is shared between multiple threads: public enum Action { Read, Write, None } Within a class I have a variable of Action type: public Action _action; This is a shared variable, that is, it is updated and read from multiple threads. For example, from one thread I do: _action = Action.Read And from another one: if (_action == Action.Read) { } else if (_action == Action.Write) { } else if (_Action == Action.None) { } else { } So I would like to use Interlock to update