diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-12-30 23:34:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-12-30 23:34:20 +0000 |
commit | cec4c4d2c9468a0d0234d306c886ba97515b1690 (patch) | |
tree | 326bbe7079e54314b42270d115ae6d39e8f037b8 /nuttx/examples/ostest/posixtimer.c | |
parent | f3532ac59f8b6bb4d4a7239b73b5fcb4b66ed6b1 (diff) | |
download | nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.gz nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.bz2 nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.zip |
More SDCC compilation fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@468 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/ostest/posixtimer.c')
-rw-r--r-- | nuttx/examples/ostest/posixtimer.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/nuttx/examples/ostest/posixtimer.c b/nuttx/examples/ostest/posixtimer.c index 1b466c99f..87498baa2 100644 --- a/nuttx/examples/ostest/posixtimer.c +++ b/nuttx/examples/ostest/posixtimer.c @@ -1,7 +1,7 @@ /*********************************************************************** * posixtimer.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -33,6 +33,10 @@ * ***********************************************************************/ +/************************************************************************** + * Included Files + **************************************************************************/ + #include <sys/types.h> #include <stdio.h> #include <unistd.h> @@ -42,6 +46,10 @@ #include <errno.h> #include "ostest.h" +/************************************************************************** + * Private Definitions + **************************************************************************/ + #ifndef NULL # define NULL (void*)0 #endif @@ -49,9 +57,23 @@ #define MY_TIMER_SIGNAL 17 #define SIGVALUE_INT 42 +#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 +# define FFLUSH() fflush(stdout) +#else +# define FFLUSH() +#endif + +/************************************************************************** + * Private Data + **************************************************************************/ + static sem_t sem; static int g_nsigreceived = 0; +/************************************************************************** + * Private Functions + **************************************************************************/ + static void timer_expiration(int signo, siginfo_t *info, void *ucontext) { sigset_t oldset; @@ -119,6 +141,10 @@ static void timer_expiration(int signo, siginfo_t *info, void *ucontext) } +/************************************************************************** + * Public Functions + **************************************************************************/ + void timer_test(void) { sigset_t sigset; @@ -200,7 +226,7 @@ void timer_test(void) for (i = 0; i < 5; i++) { printf("timer_test: Waiting on semaphore\n" ); - fflush(stdout); + FFLUSH(); status = sem_wait(&sem); if (status != 0) { @@ -239,5 +265,5 @@ errorout: status = sigaction(MY_TIMER_SIGNAL, &act, &oact); printf("timer_test: done\n" ); - fflush(stdout); + FFLUSH(); } |