testing/ostest: Fix nxstyle errors.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-04-30 00:58:23 +01:00 committed by Gustavo Henrique Nihei
parent 0e9f08e454
commit e86faa6966
3 changed files with 21 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* testing/ostest/barrier.c * apps/testing/ostest/barrier.c
* *
* Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -94,6 +94,7 @@ static void *barrier_func(void *parameter)
printf("barrier_func: ERROR thread %d could not get semaphore value\n", printf("barrier_func: ERROR thread %d could not get semaphore value\n",
id); id);
} }
FFLUSH(); FFLUSH();
usleep(HALF_SECOND); usleep(HALF_SECOND);
@ -165,6 +166,7 @@ void barrier_test(void)
printf("barrier_test: Thread %d created\n", i); printf("barrier_test: Thread %d created\n", i);
} }
} }
FFLUSH(); FFLUSH();
/* Wait for all thread instances to complete */ /* Wait for all thread instances to complete */
@ -200,5 +202,6 @@ abort_test:
printf("barrier_test: pthread_barrierattr_destroy failed, status=%d\n", printf("barrier_test: pthread_barrierattr_destroy failed, status=%d\n",
status); status);
} }
FFLUSH(); FFLUSH();
} }

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* mutex.c * apps/testing/ostest/mutex.c
* *
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -57,8 +57,16 @@
static pthread_mutex_t mut; static pthread_mutex_t mut;
static volatile int my_mutex = 0; static volatile int my_mutex = 0;
static unsigned long nloops[2] = {0, 0}; static unsigned long nloops[2] =
static unsigned long nerrors[2] = {0, 0}; {
0,
0
};
static unsigned long nerrors[2] =
{
0,
0
};
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -102,6 +110,7 @@ static void *thread_func(FAR void *parameter)
id, status); id, status);
} }
} }
pthread_exit(NULL); pthread_exit(NULL);
return NULL; /* Non-reachable -- needed for some compilers */ return NULL; /* Non-reachable -- needed for some compilers */
} }

View File

@ -107,7 +107,8 @@ static void *thread_func(FAR void *parameter)
} }
else else
{ {
fprintf(stderr, "pthread: pthread_mutex_timedlock() failed: %d\n", fprintf(stderr,
"pthread: pthread_mutex_timedlock() failed: %d\n",
status); 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. */ /* Release the lock and wait a bit in case the main thread wants it. */
pthread_mutex_unlock(&g_mutex); pthread_mutex_unlock(&g_mutex);
usleep(500*1000); usleep(500 * 1000);
} }
g_running = false; g_running = false;
@ -170,7 +171,7 @@ void timedmutex_test(void)
/* Wait a bit to assure that the thread gets a chance to start */ /* 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. */ /* 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) * 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 /* The re-lock the mutex. The pthread should now be waiting for the lock
* or a timeout. * or a timeout.