adapt for android
authorLaurent Mazet <mazet@softndesign.org>
Fri, 17 Oct 2025 21:44:57 +0000 (23:44 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Fri, 17 Oct 2025 21:44:57 +0000 (23:44 +0200)
load.c
test.c

diff --git a/load.c b/load.c
index bc370fb678c144b4388b656538f3172e5711b5a7..15b734b38693f8dfeedb3e70ae4e0ee1487d64bd 100644 (file)
--- a/load.c
+++ b/load.c
@@ -309,8 +309,8 @@ int main (int argc, char *argv[])
         cpu_set_t cpu_mask;
         CPU_ZERO (&cpu_mask);
         CPU_SET (0, &cpu_mask);
-        if (pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpu_mask) != 0) {
-            fprintf (stderr, "error: pthread_setaffinity_np\n");
+        if (sched_setaffinity (0, sizeof (cpu_set_t), &cpu_mask) != 0) {
+            fprintf (stderr, "error: sched_setaffinity\n");
             return 1;
         }
         while (mode--) {
diff --git a/test.c b/test.c
index 66d492f19736d4afa397a07d30ecd1db7e1fef23..e6250ed819aa180295f27d42f9c310ca64d353b9 100644 (file)
--- a/test.c
+++ b/test.c
@@ -71,8 +71,8 @@ void *launch (void *arg)
         cpu_set_t cpu_mask;
         CPU_ZERO (&cpu_mask);
         CPU_SET (cpu, &cpu_mask);
-        if (pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpu_mask) != 0) {
-            fprintf (stderr, "error: pthread_setaffinity_np (%d)\n", cpu);
+        if (sched_setaffinity (0, sizeof (cpu_set_t), &cpu_mask) != 0) {
+            fprintf (stderr, "error: sched_setaffinity (%d)\n", cpu);
             rc = 1;
             pthread_exit (NULL);
         }