|
|
|
|
|
by MaxGanzII
1554 days ago
|
|
> The fact that another thread sees the incremented value implies that that thread will see all stores that happened-before that incremented value. Firstly, if the writer has used no barriers, writes can emerge in any order (and may never emerge at all, anyway, even if barriers were used). Secondly, if the reader has not used barriers, then even if writes have been written in some given order, the reader will by no means observe that order. > A fence or atomic operation guarantee that a store will be visible globally in a finite amount of time A fence does NOT guarantee this. A fence controls and only only controls order of events. It has NO influence on whether events actually emerge. An atomic operation does, but this only solves the write-side of the problem; the reader still needs to issue a read barrier to guarantee seeing atomically written values. |
|