From 9d6df210edd7e883af530ef2b14d25164fcc5a6b Mon Sep 17 00:00:00 2001 From: John Sanpe Date: Sun, 11 May 2025 09:57:44 +0800 Subject: [PATCH 1/2] fixup atomic: added pthread in link libraries Signed-off-by: John Sanpe --- examples/atomic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/atomic/CMakeLists.txt b/examples/atomic/CMakeLists.txt index e9d79989..51210be2 100644 --- a/examples/atomic/CMakeLists.txt +++ b/examples/atomic/CMakeLists.txt @@ -4,7 +4,7 @@ # add_executable(atomic-spinlock spinlock.c) -target_link_libraries(atomic-spinlock bfdev) +target_link_libraries(atomic-spinlock bfdev pthread) add_test(atomic-spinlock atomic-spinlock) if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev") From 58ca8b1eea9f6cd75c7f8612b588b6cc898e6090 Mon Sep 17 00:00:00 2001 From: John Sanpe Date: Sun, 11 May 2025 10:01:00 +0800 Subject: [PATCH 2/2] fixup atomic: reduce spinlock example loops to save ci time Signed-off-by: John Sanpe --- examples/atomic/spinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/atomic/spinlock.c b/examples/atomic/spinlock.c index 469e7c09..14d8089b 100644 --- a/examples/atomic/spinlock.c +++ b/examples/atomic/spinlock.c @@ -37,7 +37,7 @@ thread1_task(void *unused) { unsigned int time; - for (time = 0; time < 1000000; ++time) { + for (time = 0; time < 100000; ++time) { spin_lock(&lock); counter++; spin_unlock(&lock); @@ -51,7 +51,7 @@ thread2_task(void *unused) { unsigned int time; - for (time = 0; time < 1000000; ++time) { + for (time = 0; time < 100000; ++time) { spin_lock(&lock); counter--; spin_unlock(&lock);