在tij中的volatile中有这么一句话:
当一个域依赖于它之前的值时(如自增), 那么volatile就无法工作了. 如果某个域的值受到其他域的值的限制, 那么volatile也无法工作, 例如Range类的lower和upper边界值必须遵循lower<=upper
这段话想要表达的意思是什么?
怪我咯2017-04-18 09:53:22
In layman’s terms, values marked as volatile may change unpredictably, so they cannot be cached and should be read from main memory each time.
Auto-increment operation, this value may change between reading and writing, so the correct result cannot be written.
Again, this value changes uncontrollably, so the invariant may not be satisfied.
迷茫2017-04-18 09:53:22
It should be that volatile
the atomicity of the operation cannot be guaranteed