summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadhandler.c
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2008-01-04 06:38:06 +0000
committerTill Straumann <strauman@slac.stanford.edu>2008-01-04 06:38:06 +0000
commit42fce5d39b324beb9a0862e89a8d12008faaad6b (patch)
tree46337f914e7305ba5fdb39c7cbdd1d7bd21e95e8 /cpukit/score/src/threadhandler.c
parent2007-12-28 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-42fce5d39b324beb9a0862e89a8d12008faaad6b.tar.bz2
2008-01-03 Till Straumann <strauman@slac.stanford.edu>
* score/src/threadhandler.c, sapi/src/exshutdown.c: cannot call _fini via atexit() from rtems_shutdown_executive() because at the point where rtems_shutdown_executive is called the C-library is already dead. Instead, register an atexit(_fini) after calling _init().
Diffstat (limited to 'cpukit/score/src/threadhandler.c')
-rw-r--r--cpukit/score/src/threadhandler.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c
index 523f623d02..f77a4ab3d0 100644
--- a/cpukit/score/src/threadhandler.c
+++ b/cpukit/score/src/threadhandler.c
@@ -30,6 +30,10 @@
#include <rtems/score/userext.h>
#include <rtems/score/wkspace.h>
+#if defined(__USE_INIT_FINI__)
+#include <stdlib.h> /* for atexit() */
+#endif
+
/*PAGE
*
* _Thread_Handler
@@ -125,7 +129,11 @@ void _Thread_Handler( void )
* RTEMS target configuration. --joel (12 May 2007)
*/
if (!doneCons) /* && (volatile void *)_init) */
+ {
+ extern void _fini( void );
_init ();
+ atexit( _fini );
+ }
#endif
#if defined(__USE__MAIN__)
if (!doneCons && _main)