0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-01-31 21:22:27 +00:00
termux-packages/packages/oidn/0001-dummy-pthread-affinity.patch
2022-09-21 21:31:24 +08:00

24 lines
682 B
Diff

--- a/common/thread.cpp
+++ b/common/thread.cpp
@@ -13,6 +13,20 @@
#include "thread.h"
#include <fstream>
+#if defined(__BIONIC__)
+static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+ cpu_set_t *cpuset) {
+ assert(pthread_equal(pthread_self(), thread));
+ return sched_setaffinity(0, cpusetsize, cpuset);
+}
+
+static inline int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize,
+ cpu_set_t *cpuset) {
+ assert(pthread_equal(pthread_self(), thread));
+ return sched_getaffinity(0, cpusetsize, cpuset);
+}
+#endif
+
namespace oidn {
#if defined(_WIN32)