mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-30 03:10:16 +00:00
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.
This commit is contained in:
parent
1410bd3bd0
commit
8ce1ec7ffa
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define cpu_set_t cpuset_t
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
int CurrentThreadId() {
|
int CurrentThreadId() {
|
||||||
|
@ -86,7 +90,7 @@ void SetCurrentThreadName(const char* szThreadName) {
|
||||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) {
|
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1);
|
thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1);
|
||||||
#elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID)
|
#elif (defined __linux__ || defined __FreeBSD__) && !(defined ANDROID)
|
||||||
cpu_set_t cpu_set;
|
cpu_set_t cpu_set;
|
||||||
CPU_ZERO(&cpu_set);
|
CPU_ZERO(&cpu_set);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue