Skip to content

Commit 5b85370

Browse files
authored
Avoid to include windows.h in realtime_helpers.hpp (#255)
1 parent d54140d commit 5b85370

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/realtime_tools/realtime_helpers.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@
3535
#include <vector>
3636

3737
#ifdef _WIN32
38-
#include <windows.h>
39-
using NATIVE_THREAD_HANDLE = HANDLE;
38+
// Here we directly use void* instead of including windows.h
39+
// and using HANDLE macro to avoid polluting all the downstream
40+
// compilation units that include the public header realtime_helpers.hpp
41+
// with problematic macros like MIN, MAX or ERROR
42+
using NATIVE_THREAD_HANDLE = void *;
4043
#else
4144
using NATIVE_THREAD_HANDLE = pthread_t;
4245
#endif

src/realtime_helpers.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
#include "realtime_tools/realtime_helpers.hpp"
3030

31-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
31+
#ifdef _WIN32
32+
#include <windows.h>
33+
#else
3234
#include <sched.h>
3335
#include <sys/capability.h>
3436
#include <sys/mman.h>

0 commit comments

Comments
 (0)