This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 36e701448cfd1b1f03369d91e6f27dd3f17eba1c
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Tue Oct 21 17:47:59 2025 +0800

    ostest/spinlock: Check the return value.
    
    This commit added checking for the return value.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 testing/ostest/spinlock.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/testing/ostest/spinlock.c b/testing/ostest/spinlock.c
index 2d71ea18f..dd49c4d54 100644
--- a/testing/ostest/spinlock.c
+++ b/testing/ostest/spinlock.c
@@ -91,7 +91,7 @@ FAR static void * lock_type##_test_thread(FAR void *arg) \
   struct timespec start; \
   struct timespec end; \
   int i; \
-  pthread_barrier_wait(&param->pub->barrier); \
+  VERIFY(0 == pthread_barrier_wait(&param->pub->barrier)); \
   clock_gettime(CLOCK_REALTIME, &start); \
   for (i = 0; i < LOOP_TIMES; i++) \
     { \
@@ -122,7 +122,7 @@ static inline void run_test_thread(
   struct timespec etime;
   int i;
 
-  pthread_barrier_init(&pub.barrier, NULL, THREAD_NUM + 1);
+  VERIFY(0 == pthread_barrier_init(&pub.barrier, NULL, THREAD_NUM + 1));
   pub.counter = 0;
   if (lock_type == RSPINLOCK)
     {
@@ -141,7 +141,7 @@ static inline void run_test_thread(
       pthread_create(&tid[i], NULL, thread_func, &param[i]);
     }
 
-  pthread_barrier_wait(&pub.barrier);
+  VERIFY(0 == pthread_barrier_wait(&pub.barrier));
 
   for (i = 0; i < THREAD_NUM; i++)
     {
@@ -149,7 +149,8 @@ static inline void run_test_thread(
     }
 
   clock_gettime(CLOCK_REALTIME, &etime);
-  pthread_barrier_destroy(&pub.barrier);
+  VERIFY(0 == pthread_barrier_destroy(&pub.barrier));
+
   uint64_t total_ns = 0;
   for (i = 0; i < THREAD_NUM; i++)
     {

Reply via email to