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().
This commit is contained in:
Till Straumann
2008-01-04 06:38:06 +00:00
parent 4779963688
commit 42fce5d39b
3 changed files with 16 additions and 9 deletions

View File

@@ -1,3 +1,11 @@
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().
2007-12-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* libcsupport/Makefile.am: _rename_r is required by newlib 1.16.0.

View File

@@ -19,10 +19,6 @@
#include <rtems/score/sysstate.h>
#include <rtems/score/thread.h>
#if defined(__USE_INIT_FINI__)
#include <stdlib.h> /* for atexit() */
#endif
/*
* rtems_shutdown_executive
*
@@ -40,11 +36,6 @@ void rtems_shutdown_executive(
)
{
if ( _System_state_Current != SYSTEM_STATE_SHUTDOWN ) {
#if defined(__USE_INIT_FINI__)
extern void _fini( void );
atexit( _fini );
#endif
_System_state_Set( SYSTEM_STATE_SHUTDOWN );
_Thread_Stop_multitasking();
}

View File

@@ -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)