testing/ostest/signest.c: Appease nxstyle
This commit is contained in:
parent
0d9579e21c
commit
0a1825b384
@ -33,6 +33,10 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -80,17 +84,17 @@ static volatile int g_nest_level;
|
|||||||
static bool signest_catchable(int signo)
|
static bool signest_catchable(int signo)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SIG_SIGSTOP_ACTION
|
#ifdef CONFIG_SIG_SIGSTOP_ACTION
|
||||||
if (signo == SIGSTOP || signo == SIGCONT)
|
if (signo == SIGSTOP || signo == SIGCONT)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIG_SIGKILL_ACTION
|
#ifdef CONFIG_SIG_SIGKILL_ACTION
|
||||||
if (signo == SIGKILL)
|
if (signo == SIGKILL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -131,8 +135,8 @@ static int waiter_main(int argc, char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("waiter_main: Waiter started\n" );
|
printf("waiter_main: Waiter started\n");
|
||||||
printf("waiter_main: Setting signal mask\n" );
|
printf("waiter_main: Setting signal mask\n");
|
||||||
|
|
||||||
sigemptyset(&set);
|
sigemptyset(&set);
|
||||||
ret = sigprocmask(SIG_SETMASK, &set, NULL);
|
ret = sigprocmask(SIG_SETMASK, &set, NULL);
|
||||||
@ -142,7 +146,7 @@ static int waiter_main(int argc, char *argv[])
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("waiter_main: Registering signal handler\n" );
|
printf("waiter_main: Registering signal handler\n");
|
||||||
|
|
||||||
act.sa_handler = waiter_action;
|
act.sa_handler = waiter_action;
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
@ -171,7 +175,7 @@ static int waiter_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Now just loop until the test completes */
|
/* Now just loop until the test completes */
|
||||||
|
|
||||||
printf("waiter_main: Waiting on semaphore\n" );
|
printf("waiter_main: Waiting on semaphore\n");
|
||||||
FFLUSH();
|
FFLUSH();
|
||||||
|
|
||||||
g_waiter_running = true;
|
g_waiter_running = true;
|
||||||
@ -190,7 +194,7 @@ static int interfere_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Now just loop staying in the way as much as possible */
|
/* Now just loop staying in the way as much as possible */
|
||||||
|
|
||||||
printf("interfere_main: Waiting on semaphore\n" );
|
printf("interfere_main: Waiting on semaphore\n");
|
||||||
FFLUSH();
|
FFLUSH();
|
||||||
|
|
||||||
g_interferer_running = true;
|
g_interferer_running = true;
|
||||||
@ -204,6 +208,7 @@ static int interfere_main(int argc, char *argv[])
|
|||||||
g_interferer_running = false;
|
g_interferer_running = false;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -243,7 +248,7 @@ void signest_test(void)
|
|||||||
ret = sched_getparam (0, ¶m);
|
ret = sched_getparam (0, ¶m);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("signest_test: ERROR sched_getparam() failed\n" );
|
printf("signest_test: ERROR sched_getparam() failed\n");
|
||||||
param.sched_priority = PTHREAD_DEFAULT_PRIORITY;
|
param.sched_priority = PTHREAD_DEFAULT_PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,9 +283,11 @@ void signest_test(void)
|
|||||||
/* Wait a bit */
|
/* Wait a bit */
|
||||||
|
|
||||||
FFLUSH();
|
FFLUSH();
|
||||||
usleep(500*1000L);
|
usleep(500 * 1000L);
|
||||||
|
|
||||||
/* Then signal the waiter thread with back-to-back signals, one masked and the other unmasked. */
|
/* Then signal the waiter thread with back-to-back signals, one masked
|
||||||
|
* and the other unmasked.
|
||||||
|
*/
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@ -298,7 +305,7 @@ void signest_test(void)
|
|||||||
even_signals++;
|
even_signals++;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
|
|
||||||
/* Even then odd */
|
/* Even then odd */
|
||||||
|
|
||||||
@ -314,7 +321,7 @@ void signest_test(void)
|
|||||||
odd_signals++;
|
odd_signals++;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +366,7 @@ void signest_test(void)
|
|||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
|
|
||||||
/* Even then odd */
|
/* Even then odd */
|
||||||
|
|
||||||
@ -379,7 +386,7 @@ void signest_test(void)
|
|||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +430,7 @@ void signest_test(void)
|
|||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
|
|
||||||
/* Even then odd */
|
/* Even then odd */
|
||||||
|
|
||||||
@ -444,7 +451,7 @@ void signest_test(void)
|
|||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
usleep(10*1000L);
|
usleep(10 * 1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +461,7 @@ errout_with_waiter:
|
|||||||
g_done = true;
|
g_done = true;
|
||||||
sem_post(&g_waiter_sem);
|
sem_post(&g_waiter_sem);
|
||||||
sem_post(&g_interferer_sem);
|
sem_post(&g_interferer_sem);
|
||||||
usleep(500*1000L);
|
usleep(500 * 1000L);
|
||||||
|
|
||||||
/* Check the final test results */
|
/* Check the final test results */
|
||||||
|
|
||||||
@ -509,6 +516,6 @@ errout_with_waiter:
|
|||||||
sem_destroy(&g_waiter_sem);
|
sem_destroy(&g_waiter_sem);
|
||||||
sem_destroy(&g_interferer_sem);
|
sem_destroy(&g_interferer_sem);
|
||||||
|
|
||||||
printf("signest_test: done\n" );
|
printf("signest_test: done\n");
|
||||||
FFLUSH();
|
FFLUSH();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user