]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/language/c/libc/startup/v2_0/src/main.cxx
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / language / c / libc / startup / v2_0 / src / main.cxx
index a43723ad5273eada051cfea2656c99d0f9606557..68b05d17a5338c95714cc78778ddfc43f9309abe 100644 (file)
 #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);