Mercurial > nand-ecoscentric
changeset 2437:66ce5ec27360
* src/main.cxx (main): Suspend main thread, rather than exit.
Thanks to Sergei Organov for the idea.
| author | jlarmour |
|---|---|
| date | Fri, 05 Oct 2007 17:41:48 +0000 |
| parents | ba162aa5247c |
| children | 8317d1af06db |
| files | packages/language/c/libc/startup/current/ChangeLog packages/language/c/libc/startup/current/src/main.cxx |
| diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/language/c/libc/startup/current/ChangeLog +++ b/packages/language/c/libc/startup/current/ChangeLog @@ -1,3 +1,8 @@ +2007-10-05 Jonathan Larmour <jifl@eCosCentric.com> + + * src/main.cxx (main): Suspend main thread, rather than exit. + Thanks to Sergei Organov for the idea. + 2007-09-11 Andrew Lunn <andrew.lunn@ascom.ch> * src/cstartup.cxx: Change the INIT priority of
--- a/packages/language/c/libc/startup/current/src/main.cxx +++ b/packages/language/c/libc/startup/current/src/main.cxx @@ -66,6 +66,12 @@ #include <cyg/infra/cyg_trac.h> // Common tracing support #include <cyg/infra/cyg_ass.h> // Common assertion support +#ifdef CYGPKG_KERNEL +# include <pkgconf/kernel.h> // kernel configuration +# include <cyg/kernel/thread.hxx> // For thread suspend +# include <cyg/kernel/thread.inl> +#endif + // FUNCTION PROTOTYPES // We provide a weakly named main to allow this to link if the user @@ -103,6 +109,10 @@ main( int argc, char *argv[] ) // Its better than just exiting #ifndef CYGPKG_KERNEL cyg_user_start(); +#else + // Otherwise we suspend ourselves. This prevents problems caused by + // running atexit() handlers. + Cyg_Thread::self()->suspend(); #endif CYG_REPORT_RETVAL(0);
