Index: runtime/src/kmp_os.h =================================================================== --- runtime/src/kmp_os.h +++ runtime/src/kmp_os.h @@ -248,15 +248,16 @@ #define __forceinline __inline #endif -#define PAGE_SIZE (0x4000) +#if KMP_OS_WINDOWS +#include -#if KMP_OS_LINUX -#define KMP_GET_PAGE_SIZE() getpagesize() -#else -// TODO: find the corresponding function to getpagesize() in Windows -// and use it whenever possible. -#define KMP_GET_PAGE_SIZE() PAGE_SIZE +static inline int getpagesize(void) { + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} #endif +#define KMP_GET_PAGE_SIZE() getpagesize() #define PAGE_ALIGNED(_addr) \ (!((size_t)_addr & (size_t)(KMP_GET_PAGE_SIZE() - 1))) @@ -308,8 +309,6 @@ // Synchronization primitives #if KMP_ASM_INTRINS && KMP_OS_WINDOWS - -#include #pragma intrinsic(InterlockedExchangeAdd) #pragma intrinsic(InterlockedCompareExchange)