diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-28 13:02:36 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-28 13:02:36 -0600 |
commit | 8aed46c0d53be355372066ed2cb7eeb5993c65d7 (patch) | |
tree | 3ce834f96629b6f333a48f705f1ab2643645572d /apps/examples/ostest/sem.c | |
parent | 4ea6d399799d8bb94cca45b26e2bc2d5784a1792 (diff) | |
download | nuttx-8aed46c0d53be355372066ed2cb7eeb5993c65d7.tar.gz nuttx-8aed46c0d53be355372066ed2cb7eeb5993c65d7.tar.bz2 nuttx-8aed46c0d53be355372066ed2cb7eeb5993c65d7.zip |
Add a simple named semaphore test to the OS test
Diffstat (limited to 'apps/examples/ostest/sem.c')
-rw-r--r-- | apps/examples/ostest/sem.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/examples/ostest/sem.c b/apps/examples/ostest/sem.c index 5c7f39cce..14d0c0725 100644 --- a/apps/examples/ostest/sem.c +++ b/apps/examples/ostest/sem.c @@ -33,18 +33,34 @@ * ***********************************************************************/ +/*********************************************************************** + * Included Files + ***********************************************************************/ + #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <sched.h> #include "ostest.h" +/*********************************************************************** + * Pre-processor Definitions + ***********************************************************************/ + #ifndef NULL # define NULL (void*)0 #endif +/*********************************************************************** + * Private Data + ***********************************************************************/ + static sem_t sem; +/*********************************************************************** + * Private Functions + ***********************************************************************/ + static void *waiter_func(void *parameter) { int id = (int)parameter; @@ -138,6 +154,10 @@ static void *poster_func(void *parameter) } +/*********************************************************************** + * Public Functions + ***********************************************************************/ + void sem_test(void) { pthread_t waiter_thread1 = (pthread_t)0; |