Commit b7b3f1a
authored
The previous description only mentioned thread visibility as the reason for
using volatile to modify the state variable. However, volatile's more important
role here is preventing instruction reordering through the happens-before rule
(volatile write happens-before subsequent read), which ensures the correctness
of lock semantics.
Fixes #2516
1 parent 38f77e3 commit b7b3f1a
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
0 commit comments