[PATCH] Thread: Fix setThreadAffinity issue
Harvey Yang
chenghaoyang at chromium.org
Mon Dec 2 10:04:53 CET 2024
This fixes commit 4d9db06d669044c0c461a2aed79c85c7fe32a502.
Previously we call Thread::setThreadAffinityInternal in
Thread::startThread, which seems to lead to a SEGV in
pthread_setaffinity_np.
This patch moves the call after the construction of std::thread.
Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
---
src/libcamera/base/thread.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
index f6322fe31..319bfda9a 100644
--- a/src/libcamera/base/thread.cpp
+++ b/src/libcamera/base/thread.cpp
@@ -257,6 +257,8 @@ void Thread::start()
data_->exit_.store(false, std::memory_order_relaxed);
thread_ = std::thread(&Thread::startThread, this);
+
+ setThreadAffinityInternal();
}
void Thread::startThread()
@@ -284,8 +286,6 @@ void Thread::startThread()
data_->tid_ = syscall(SYS_gettid);
currentThreadData = data_;
- setThreadAffinityInternal();
-
run();
}
--
2.47.0.338.g60cca15819-goog
More information about the libcamera-devel
mailing list