Просмотр исходного кода

Merge pull request #121 from jtgrassie/msys-cast

benchmark: fix MSYS thread handle cast
tevador 7 лет назад
Родитель
Сommit
b797896479
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/tests/affinity.cpp

+ 2 - 2
src/tests/affinity.cpp

@@ -45,7 +45,7 @@ set_thread_affinity(const unsigned &cpuid)
 {
 {
     std::thread::native_handle_type thread;
     std::thread::native_handle_type thread;
 #if defined(_WIN32) || defined(__CYGWIN__)
 #if defined(_WIN32) || defined(__CYGWIN__)
-    thread = static_cast<std::thread::native_handle_type>(GetCurrentThread());
+    thread = reinterpret_cast<std::thread::native_handle_type>(GetCurrentThread());
 #else
 #else
     thread = static_cast<std::thread::native_handle_type>(pthread_self());
     thread = static_cast<std::thread::native_handle_type>(pthread_self());
 #endif
 #endif
@@ -64,7 +64,7 @@ set_thread_affinity(std::thread::native_handle_type thread,
     rc = thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY,
     rc = thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY,
             (thread_policy_t)&policy, 1);
             (thread_policy_t)&policy, 1);
 #elif defined(_WIN32) || defined(__CYGWIN__)
 #elif defined(_WIN32) || defined(__CYGWIN__)
-    rc = SetThreadAffinityMask(static_cast<HANDLE>(thread), 1ULL << cpuid) == 0 ? -2 : 0;
+    rc = SetThreadAffinityMask(reinterpret_cast<HANDLE>(thread), 1ULL << cpuid) == 0 ? -2 : 0;
 #else
 #else
     cpu_set_t cs;
     cpu_set_t cs;
     CPU_ZERO(&cs);
     CPU_ZERO(&cs);