From b807450e982a0e486d3bb266c4314d08ab4eabd2 Mon Sep 17 00:00:00 2001 From: rainlow <37818892+rainlow@users.noreply.github.com> Date: Sat, 22 Feb 2025 05:01:16 +0800 Subject: [PATCH] unix: add thread affinity support on openharmony (#4705) --- src/unix/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/thread.c b/src/unix/thread.c index e51c2904..34fea364 100644 --- a/src/unix/thread.c +++ b/src/unix/thread.c @@ -214,7 +214,7 @@ int uv_thread_setaffinity(uv_thread_t* tid, if (cpumask[i]) CPU_SET(i, &cpuset); -#if defined(__ANDROID__) +#if defined(__ANDROID__) || defined(__OHOS__) if (sched_setaffinity(pthread_gettid_np(*tid), sizeof(cpuset), &cpuset)) r = errno; else @@ -242,7 +242,7 @@ int uv_thread_getaffinity(uv_thread_t* tid, return UV_EINVAL; CPU_ZERO(&cpuset); -#if defined(__ANDROID__) +#if defined(__ANDROID__) || defined(__OHOS__) if (sched_getaffinity(pthread_gettid_np(*tid), sizeof(cpuset), &cpuset)) r = errno; else