| Index: runtime/vm/atomic_win.h
|
| diff --git a/runtime/vm/atomic_win.h b/runtime/vm/atomic_win.h
|
| index 410c1a2bf1986a7e7d5a3c11f485607266501ff2..2ade768e2f19e33f86afc840fb2b239500a4a82f 100644
|
| --- a/runtime/vm/atomic_win.h
|
| +++ b/runtime/vm/atomic_win.h
|
| @@ -32,12 +32,12 @@ inline uintptr_t AtomicOperations::FetchAndIncrementBy(intptr_t* p,
|
| intptr_t value) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<uintptr_t>(
|
| - InterlockedAdd64(reinterpret_cast<LONGLONG*>(p),
|
| - static_cast<LONGLONG>(value))) - value;
|
| + InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
|
| + static_cast<LONGLONG>(value)));
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<uintptr_t>(
|
| - InterlockedAdd(reinterpret_cast<LONG*>(p),
|
| - static_cast<LONG>(value))) - value;
|
| + InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
|
| + static_cast<LONG>(value)));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -61,12 +61,12 @@ inline uintptr_t AtomicOperations::FetchAndDecrementBy(intptr_t* p,
|
| intptr_t value) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<uintptr_t>(
|
| - InterlockedAdd64(reinterpret_cast<LONGLONG*>(p),
|
| - static_cast<LONGLONG>(-value))) + value;
|
| + InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
|
| + static_cast<LONGLONG>(-value)));
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<uintptr_t>(
|
| - InterlockedAdd(reinterpret_cast<LONG*>(p),
|
| - static_cast<LONG>(-value))) + value;
|
| + InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
|
| + static_cast<LONG>(-value)));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
|
|