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/timedwait.c | |
parent | f3532ac59f8b6bb4d4a7239b73b5fcb4b66ed6b1 (diff) | |
download | px4-nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.gz px4-nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.bz2 px4-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/timedwait.c')
-rw-r--r-- | nuttx/examples/ostest/timedwait.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/nuttx/examples/ostest/timedwait.c b/nuttx/examples/ostest/timedwait.c index 0bc47c693..51622bad8 100644 --- a/nuttx/examples/ostest/timedwait.c +++ b/nuttx/examples/ostest/timedwait.c @@ -1,7 +1,7 @@ /*********************************************************************** - * timedwait.c + * examples/ostest/timedwait.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,16 +33,39 @@ * ***********************************************************************/ +/************************************************************************** + * Included Files + **************************************************************************/ + #include <stdio.h> #include <time.h> #include <pthread.h> #include <unistd.h> #include <errno.h> + #include "ostest.h" +/************************************************************************** + * Private Definitions + **************************************************************************/ + +#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 +# define FFLUSH() fflush(stdout) +#else +# define FFLUSH() +#endif + +/************************************************************************** + * Private Data + **************************************************************************/ + static pthread_mutex_t mutex; static pthread_cond_t cond; +/************************************************************************** + * Private Functions + **************************************************************************/ + static void *thread_waiter(void *parameter) { struct timespec time; @@ -99,6 +122,10 @@ static void *thread_waiter(void *parameter) return NULL; } +/************************************************************************** + * Public Definitions + **************************************************************************/ + void timedwait_test(void) { pthread_t waiter; @@ -161,7 +188,7 @@ void timedwait_test(void) } printf("timedwait_test: Joining\n"); - fflush(stdout); + FFLUSH(); status = pthread_join(waiter, &result); if (status != 0) { |