From 13310f283963dc559ac309f93692b2d0c5bdadf7 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Thu, 4 Aug 2016 15:38:29 -0700 Subject: [PATCH] Eliminate the atomic porability header's dependence on Windows.h Summary: This is done by using the intrinsic directly instead. This also marks the input parameter as `volatile`, to make it more clear that that's how it is handled by `_InterlockedExchangeAdd64`. Reviewed By: yfeldblum Differential Revision: D3671320 fbshipit-source-id: 6010085ec3b6952a3eb1e952965ec6ad87566db2 --- folly/portability/Atomic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/folly/portability/Atomic.h b/folly/portability/Atomic.h index 811c24cc..8aa9f307 100755 --- a/folly/portability/Atomic.h +++ b/folly/portability/Atomic.h @@ -18,14 +18,14 @@ #ifdef _WIN32 +#include #include #include -// The intrinsics we need are in Windows.h :( -#include -FOLLY_ALWAYS_INLINE int64_t __sync_fetch_and_add(int64_t* ptr, int64_t value) { - return InterlockedExchangeAdd64(ptr, value); +FOLLY_ALWAYS_INLINE +int64_t __sync_fetch_and_add(volatile int64_t* ptr, int64_t value) { + return _InterlockedExchangeAdd64(ptr, value); } #endif -- 2.34.1