Skip to content

Commit a9b1ee9

Browse files
Merge pull request #2663 from johnplatts:hwy_win32_fix_081225
PiperOrigin-RevId: 794758687
2 parents a0b07d0 + f687368 commit a9b1ee9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

hwy/contrib/thread_pool/futex.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131

3232
#include "hwy/base.h"
3333

34+
#if HWY_OS_WIN
35+
// Need to include <windows.h> on Windows, even if HWY_DISABLE_FUTEX is defined,
36+
// since hwy::NanoSleep uses Windows API's that are defined in windows.h.
37+
#ifndef NOMINMAX
38+
#define NOMINMAX
39+
#endif // NOMINMAX
40+
#ifndef WIN32_LEAN_AND_MEAN
41+
#define WIN32_LEAN_AND_MEAN
42+
#endif // WIN32_LEAN_AND_MEAN
43+
#include <windows.h>
44+
#endif
45+
3446
#if HWY_ARCH_WASM
3547
#include <emscripten/threading.h>
3648
#include <math.h> // INFINITY
@@ -67,13 +79,6 @@ int __ulock_wake(uint32_t op, void* address, uint64_t zero);
6779

6880
#elif HWY_OS_WIN && !defined(HWY_DISABLE_FUTEX)
6981
// WakeByAddressAll requires Windows 8, so add an opt-out.
70-
#ifndef NOMINMAX
71-
#define NOMINMAX
72-
#endif // NOMINMAX
73-
#ifndef WIN32_LEAN_AND_MEAN
74-
#define WIN32_LEAN_AND_MEAN
75-
#endif // WIN32_LEAN_AND_MEAN
76-
#include <windows.h>
7782
#if HWY_COMPILER_MSVC || HWY_COMPILER_CLANGCL
7883
#pragma comment(lib, "synchronization.lib")
7984
#endif

0 commit comments

Comments
 (0)