Fix POSIX C++11 build

I broke this in 46fd114e9a.
master^2
ShadowNinja 2016-04-30 09:44:28 -04:00
parent ae75073944
commit a53357d291
1 changed files with 9 additions and 9 deletions

View File

@ -205,9 +205,9 @@ bool Thread::kill()
// We need to pthread_kill instead on Android since NDKv5's pthread // We need to pthread_kill instead on Android since NDKv5's pthread
// implementation is incomplete. // implementation is incomplete.
# ifdef __ANDROID__ # ifdef __ANDROID__
pthread_kill(m_thread_handle, SIGKILL); pthread_kill(getThreadHandle(), SIGKILL);
# else # else
pthread_cancel(m_thread_handle); pthread_cancel(getThreadHandle());
# endif # endif
wait(); wait();
#endif #endif
@ -361,7 +361,7 @@ bool Thread::bindToProcessor(unsigned int proc_number)
#elif defined(_WIN32) #elif defined(_WIN32)
return SetThreadAffinityMask(m_thread_handle, 1 << proc_number); return SetThreadAffinityMask(getThreadHandle(), 1 << proc_number);
#elif __FreeBSD_version >= 702106 || defined(__linux) || defined(linux) #elif __FreeBSD_version >= 702106 || defined(__linux) || defined(linux)
@ -370,7 +370,7 @@ bool Thread::bindToProcessor(unsigned int proc_number)
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
CPU_SET(proc_number, &cpuset); CPU_SET(proc_number, &cpuset);
return pthread_setaffinity_np(m_thread_handle, sizeof(cpuset), &cpuset) == 0; return pthread_setaffinity_np(getThreadHandle(), sizeof(cpuset), &cpuset) == 0;
#elif defined(__sun) || defined(sun) #elif defined(__sun) || defined(sun)
@ -385,13 +385,13 @@ bool Thread::bindToProcessor(unsigned int proc_number)
pthread_spu_t answer; pthread_spu_t answer;
return pthread_processor_bind_np(PTHREAD_BIND_ADVISORY_NP, return pthread_processor_bind_np(PTHREAD_BIND_ADVISORY_NP,
&answer, proc_number, m_thread_handle) == 0; &answer, proc_number, getThreadHandle()) == 0;
#elif defined(__APPLE__) #elif defined(__APPLE__)
struct thread_affinity_policy tapol; struct thread_affinity_policy tapol;
thread_port_t threadport = pthread_mach_thread_np(m_thread_handle); thread_port_t threadport = pthread_mach_thread_np(getThreadHandle());
tapol.affinity_tag = proc_number + 1; tapol.affinity_tag = proc_number + 1;
return thread_policy_set(threadport, THREAD_AFFINITY_POLICY, return thread_policy_set(threadport, THREAD_AFFINITY_POLICY,
(thread_policy_t)&tapol, (thread_policy_t)&tapol,
@ -409,21 +409,21 @@ bool Thread::setPriority(int prio)
{ {
#if defined(_WIN32) #if defined(_WIN32)
return SetThreadPriority(m_thread_handle, prio); return SetThreadPriority(getThreadHandle(), prio);
#else #else
struct sched_param sparam; struct sched_param sparam;
int policy; int policy;
if (pthread_getschedparam(m_thread_handle, &policy, &sparam) != 0) if (pthread_getschedparam(getThreadHandle(), &policy, &sparam) != 0)
return false; return false;
int min = sched_get_priority_min(policy); int min = sched_get_priority_min(policy);
int max = sched_get_priority_max(policy); int max = sched_get_priority_max(policy);
sparam.sched_priority = min + prio * (max - min) / THREAD_PRIORITY_HIGHEST; sparam.sched_priority = min + prio * (max - min) / THREAD_PRIORITY_HIGHEST;
return pthread_setschedparam(m_thread_handle, policy, &sparam) == 0; return pthread_setschedparam(getThreadHandle(), policy, &sparam) == 0;
#endif #endif
} }