Commit ad9eb05
committed
std: sysatomics: fix use of atomicCompareExchangeN for MSVC
InterlockedCompareExchange64 (winnt.h) is used instead of gcc atomics
when compiling with MSVC on Windows, but the function signatures are
InterlockedCompareExchange64(ptr int64, int64, int64) and
InterlockedCompareExchange32(ptr int32, int32, int32) as opposed to
(ptr T, ptr T, T) for __atomic_compare_exchange_n.
Passing a pointer to the expected value instead of the value itself
causes the comparison to unconditionally fail, with stalls in threaded
code using atomic comparisons.
Fix the function signature for MSVC.
Signed-off-by: Ryan Walklin <[email protected]>1 parent 91febf1 commit ad9eb05
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
| 233 | + | |
| 234 | + | |
235 | 235 | | |
236 | | - | |
237 | | - | |
| 236 | + | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
0 commit comments