From e86faa6966bb80e4892519caab678c56abb01eec Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Fri, 30 Apr 2021 00:58:23 +0100 Subject: [PATCH] testing/ostest: Fix nxstyle errors. Signed-off-by: Abdelatif Guettouche --- testing/ostest/barrier.c | 5 ++++- testing/ostest/mutex.c | 15 ++++++++++++--- testing/ostest/timedmutex.c | 9 +++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/testing/ostest/barrier.c b/testing/ostest/barrier.c index 4078a69db..f13eb339f 100644 --- a/testing/ostest/barrier.c +++ b/testing/ostest/barrier.c @@ -1,5 +1,5 @@ /**************************************************************************** - * testing/ostest/barrier.c + * apps/testing/ostest/barrier.c * * Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -94,6 +94,7 @@ static void *barrier_func(void *parameter) printf("barrier_func: ERROR thread %d could not get semaphore value\n", id); } + FFLUSH(); usleep(HALF_SECOND); @@ -165,6 +166,7 @@ void barrier_test(void) printf("barrier_test: Thread %d created\n", i); } } + FFLUSH(); /* Wait for all thread instances to complete */ @@ -200,5 +202,6 @@ abort_test: printf("barrier_test: pthread_barrierattr_destroy failed, status=%d\n", status); } + FFLUSH(); } diff --git a/testing/ostest/mutex.c b/testing/ostest/mutex.c index 92ca372e2..b1bc37790 100644 --- a/testing/ostest/mutex.c +++ b/testing/ostest/mutex.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mutex.c + * apps/testing/ostest/mutex.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,8 +57,16 @@ static pthread_mutex_t mut; static volatile int my_mutex = 0; -static unsigned long nloops[2] = {0, 0}; -static unsigned long nerrors[2] = {0, 0}; +static unsigned long nloops[2] = + { + 0, + 0 + }; +static unsigned long nerrors[2] = + { + 0, + 0 + }; /**************************************************************************** * Private Functions @@ -102,6 +110,7 @@ static void *thread_func(FAR void *parameter) id, status); } } + pthread_exit(NULL); return NULL; /* Non-reachable -- needed for some compilers */ } diff --git a/testing/ostest/timedmutex.c b/testing/ostest/timedmutex.c index cd1c6ed53..0863155e0 100644 --- a/testing/ostest/timedmutex.c +++ b/testing/ostest/timedmutex.c @@ -107,7 +107,8 @@ static void *thread_func(FAR void *parameter) } else { - fprintf(stderr, "pthread: pthread_mutex_timedlock() failed: %d\n", + fprintf(stderr, + "pthread: pthread_mutex_timedlock() failed: %d\n", status); } @@ -120,7 +121,7 @@ static void *thread_func(FAR void *parameter) /* Release the lock and wait a bit in case the main thread wants it. */ pthread_mutex_unlock(&g_mutex); - usleep(500*1000); + usleep(500 * 1000); } g_running = false; @@ -170,7 +171,7 @@ void timedmutex_test(void) /* Wait a bit to assure that the thread gets a chance to start */ - usleep(500*1000); + usleep(500 * 1000); /* Then unlock the mutex. This should wake up the pthread. */ @@ -181,7 +182,7 @@ void timedmutex_test(void) * least once (it may probably loop and retake the mutex several times) */ - usleep(500*1000); + usleep(500 * 1000); /* The re-lock the mutex. The pthread should now be waiting for the lock * or a timeout.