mirror of
https://github.com/termux/termux-packages.git
synced 2025-01-31 21:22:27 +00:00
24 lines
682 B
Diff
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)
|