summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Beich2016-10-10 02:33:41 +0000
committerGravatar Jan Beich2016-10-27 23:28:29 +0000
commit8ce1ec7ffa6b912dfa776d6923a7af18a7761f67 (patch)
treec01e4f77d180716712cd8fd78e6c855b4f641d32 /src
parentcommon: define routines to set thread name on more BSDs (diff)
downloadyuzu-8ce1ec7ffa6b912dfa776d6923a7af18a7761f67.tar.gz
yuzu-8ce1ec7ffa6b912dfa776d6923a7af18a7761f67.tar.xz
yuzu-8ce1ec7ffa6b912dfa776d6923a7af18a7761f67.zip
common: only FreeBSD has thread affinity compatible with Linux
src/common/thread.cpp:90:5: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'? cpu_set_t cpu_set; ^~~~~~~~~ cpuset_t /usr/include/sys/_cpuset.h:48:24: note: 'cpuset_t' declared here typedef struct _cpuset cpuset_t; ^ 1 error generated.
Diffstat (limited to 'src')
-rw-r--r--src/common/thread.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index a4f5fa336..9bb2f4e1d 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -19,6 +19,10 @@
19#include <unistd.h> 19#include <unistd.h>
20#endif 20#endif
21 21
22#ifdef __FreeBSD__
23#define cpu_set_t cpuset_t
24#endif
25
22namespace Common { 26namespace Common {
23 27
24int CurrentThreadId() { 28int CurrentThreadId() {
@@ -86,7 +90,7 @@ void SetCurrentThreadName(const char* szThreadName) {
86void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { 90void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) {
87#ifdef __APPLE__ 91#ifdef __APPLE__
88 thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); 92 thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1);
89#elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID) 93#elif (defined __linux__ || defined __FreeBSD__) && !(defined ANDROID)
90 cpu_set_t cpu_set; 94 cpu_set_t cpu_set;
91 CPU_ZERO(&cpu_set); 95 CPU_ZERO(&cpu_set);
92 96