From: Christopher Dykes Date: Thu, 4 Aug 2016 22:38:29 +0000 (-0700) Subject: Eliminate the atomic porability header's dependence on Windows.h X-Git-Tag: v2016.08.08.00~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=13310f283963dc559ac309f93692b2d0c5bdadf7;p=folly.git 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 --- 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