diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-09 17:08:13 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-09 17:08:13 +0200 |
commit | aa9b3594e11498ca0977d87a9d0875d7fc107253 (patch) | |
tree | 8e4e3152088a56611822c6e881179e89e69bef13 /src/threading_osx.h | |
parent | 95932749a53f46ae5901798a17e1f0c4c33ac6b2 (diff) | |
download | lanes-aa9b3594e11498ca0977d87a9d0875d7fc107253.tar.gz lanes-aa9b3594e11498ca0977d87a9d0875d7fc107253.tar.bz2 lanes-aa9b3594e11498ca0977d87a9d0875d7fc107253.zip |
C++ migration: [[nodiscard]] everywhere. still have to check all std::ignore
Diffstat (limited to 'src/threading_osx.h')
-rw-r--r-- | src/threading_osx.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/threading_osx.h b/src/threading_osx.h index b47d2f6..f4d41e0 100644 --- a/src/threading_osx.h +++ b/src/threading_osx.h | |||
@@ -2,8 +2,7 @@ | |||
2 | * THREADING_OSX.H | 2 | * THREADING_OSX.H |
3 | * http://yyshen.github.io/2015/01/18/binding_threads_to_cores_osx.html | 3 | * http://yyshen.github.io/2015/01/18/binding_threads_to_cores_osx.html |
4 | */ | 4 | */ |
5 | #ifndef __threading_osx_h__ | 5 | #pragma once |
6 | #define __threading_osx_h__ 1 | ||
7 | 6 | ||
8 | #include <mach/mach_types.h> | 7 | #include <mach/mach_types.h> |
9 | #include <mach/thread_act.h> | 8 | #include <mach/thread_act.h> |
@@ -18,9 +17,9 @@ struct cpu_set_t | |||
18 | 17 | ||
19 | static inline void CPU_ZERO(cpu_set_t *cs) { cs->count = 0; } | 18 | static inline void CPU_ZERO(cpu_set_t *cs) { cs->count = 0; } |
20 | static inline void CPU_SET(int num, cpu_set_t *cs) { cs->count |= (1 << num); } | 19 | static inline void CPU_SET(int num, cpu_set_t *cs) { cs->count |= (1 << num); } |
21 | static inline int CPU_ISSET(int num, cpu_set_t *cs) { return (cs->count & (1 << num)); } | 20 | [[nodiscard]] static inline int CPU_ISSET(int num, cpu_set_t *cs) { return (cs->count & (1 << num)); } |
22 | 21 | ||
23 | int sched_getaffinity(pid_t pid, size_t cpu_size, cpu_set_t *cpu_set) | 22 | [[nodiscard]] int sched_getaffinity(pid_t pid, size_t cpu_size, cpu_set_t *cpu_set) |
24 | { | 23 | { |
25 | int32_t core_count = 0; | 24 | int32_t core_count = 0; |
26 | size_t len = sizeof(core_count); | 25 | size_t len = sizeof(core_count); |
@@ -39,7 +38,7 @@ int sched_getaffinity(pid_t pid, size_t cpu_size, cpu_set_t *cpu_set) | |||
39 | return 0; | 38 | return 0; |
40 | } | 39 | } |
41 | 40 | ||
42 | int pthread_setaffinity_np(pthread_t thread, size_t cpu_size, cpu_set_t *cpu_set) | 41 | [[nodiscard]] int pthread_setaffinity_np(pthread_t thread, size_t cpu_size, cpu_set_t *cpu_set) |
43 | { | 42 | { |
44 | thread_port_t mach_thread; | 43 | thread_port_t mach_thread; |
45 | int core = 0; | 44 | int core = 0; |
@@ -57,4 +56,3 @@ int pthread_setaffinity_np(pthread_t thread, size_t cpu_size, cpu_set_t *cpu_set | |||
57 | return 0; | 56 | return 0; |
58 | } | 57 | } |
59 | 58 | ||
60 | #endif | ||