diff --git a/include/treelite/predictor.h b/include/treelite/predictor.h index 9769115e..430e33f8 100644 --- a/include/treelite/predictor.h +++ b/include/treelite/predictor.h @@ -16,6 +16,11 @@ #include #include +#ifdef _WIN32 +#define NOMINMAX +#include +#endif // _WIN32 + namespace treelite { namespace predictor { @@ -71,8 +76,13 @@ union Entry { class SharedLibrary { public: +#ifdef _WIN32 + using LibraryHandle = HMODULE; + using FunctionHandle = FARPROC; +#else // _WIN32 using LibraryHandle = void*; using FunctionHandle = void*; +#endif // _WIN32 SharedLibrary(); ~SharedLibrary(); void Load(const char* libpath); diff --git a/src/predictor/thread_pool/thread_pool.h b/src/predictor/thread_pool/thread_pool.h index 78f7aff9..b6c5ef78 100644 --- a/src/predictor/thread_pool/thread_pool.h +++ b/src/predictor/thread_pool/thread_pool.h @@ -81,12 +81,7 @@ class ThreadPool { inline void SetAffinity() { #ifdef _WIN32 - /* Windows */ - SetThreadAffinityMask(GetCurrentThread(), 0x1); - for (int i = 0; i < num_worker_; ++i) { - const int core_id = i + 1; - SetThreadAffinityMask(thread_[i].native_handle(), (1ULL << core_id)); - } + /* Do not set thread affinity on Windows */ #elif defined(__APPLE__) && defined(__MACH__) #include #if TARGET_OS_MAC == 1