diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-28 21:42:18 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-28 21:42:18 +0000 |
commit | 94c7babe23d72a1e379da0cf0aab32fcf9fadcf3 (patch) | |
tree | eedc930a4ed4a1108c87cae26d3fcda7e411dd1f /apps/examples/ostest/barrier.c | |
parent | 405c2b328ff4cd571bb9e464541b4d297b18f93d (diff) | |
download | px4-nuttx-94c7babe23d72a1e379da0cf0aab32fcf9fadcf3.tar.gz px4-nuttx-94c7babe23d72a1e379da0cf0aab32fcf9fadcf3.tar.bz2 px4-nuttx-94c7babe23d72a1e379da0cf0aab32fcf9fadcf3.zip |
atexit() functions now called when task killed by task delete; For MCUs with <= 64Kb of SRAM, CONFIG_MM_SMALL can be defined to reduce the memory allocation overhead
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3648 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/ostest/barrier.c')
-rw-r--r-- | apps/examples/ostest/barrier.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/examples/ostest/barrier.c b/apps/examples/ostest/barrier.c index c88e1bed1..da1301dc3 100644 --- a/apps/examples/ostest/barrier.c +++ b/apps/examples/ostest/barrier.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/ostest/barrier.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ static void *barrier_func(void *parameter) printf("barrier_func: Thread %d calling pthread_barrier_wait()\n", id); + FFLUSH(); status = pthread_barrier_wait(&barrier); if (status == 0) { @@ -95,11 +96,13 @@ static void *barrier_func(void *parameter) printf("barrier_func: ERROR thread %d could not get semaphore value\n", id); } + FFLUSH(); #ifndef CONFIG_DISABLE_SIGNALS usleep(HALF_SECOND); #endif printf("barrier_func: Thread %d done\n", id); + FFLUSH(); return NULL; } @@ -158,12 +161,15 @@ void barrier_test(void) { printf("barrier_test: Error in thread %d create, status=%d\n", i, status); + printf("barrier_test: Test aborted with waiting threads\n"); + goto abort_test; } else { printf("barrier_test: Thread %d created\n", i); } } + FFLUSH(); /* Wait for all thread instances to complete */ @@ -184,6 +190,7 @@ void barrier_test(void) /* Destroy the barrier */ +abort_test: status = pthread_barrier_destroy(&barrier); if (status != OK) { @@ -197,4 +204,5 @@ void barrier_test(void) printf("barrier_test: pthread_barrierattr_destroy failed, status=%d\n", status); } + FFLUSH(); } |