From 4bc5f43904f1c59ee270e61bba2761e0faacaf26 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 1 Jul 2019 19:16:12 +0200 Subject: [PATCH] Fixed mingw compilation --- src/tests/affinity.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tests/affinity.cpp b/src/tests/affinity.cpp index a73fcbd..a9b6bce 100644 --- a/src/tests/affinity.cpp +++ b/src/tests/affinity.cpp @@ -45,7 +45,7 @@ set_thread_affinity(const unsigned &cpuid) { std::thread::native_handle_type thread; #if defined(_WIN32) || defined(__CYGWIN__) - thread = static_cast(GetCurrentThread()); + thread = (std::thread::native_handle_type)(GetCurrentThread()); #else thread = static_cast(pthread_self()); #endif @@ -61,10 +61,9 @@ set_thread_affinity(std::thread::native_handle_type thread, thread_port_t mach_thread; thread_affinity_policy_data_t policy = { static_cast(cpuid) }; mach_thread = pthread_mach_thread_np(thread); - rc = thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, - (thread_policy_t)&policy, 1); + rc = thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1); #elif defined(_WIN32) || defined(__CYGWIN__) - rc = SetThreadAffinityMask(thread, 1ULL << cpuid) == 0 ? -2 : 0; + rc = SetThreadAffinityMask((HANDLE) thread, 1ULL << cpuid) == 0 ? -2 : 0; #else cpu_set_t cs; CPU_ZERO(&cs);