Lock
1、Lock最最常见的Mutual exclusion,本文对它进行详细说明。
2、Lock是pessimistic的,关于此,参见
wikipedia Mutual exclusion
In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters its critical section at the same time that another concurrent thread of execution enters its own critical section, which refers to an interval of time during which a thread of execution accesses a shared resource, such as shared memory.
wikipedia Lock (computer science)
TODO
https://stackoverflow.com/questions/2252452/does-a-getter-function-need-a-mutex
https://www.informit.com/articles/article.aspx?p=1750198&seqNum=3
https://stackoverflow.com/questions/17217268/c-sharp-is-locking-within-getters-and-setters-necessary
https://rules.sonarsource.com/cpp/RSPEC-1912
https://help.semmle.com/wiki/display/CSHARP/Inconsistently+synchronized+property