X-Git-Url: https://git.karo-electronics.de/?p=karo-tx-redboot.git;a=blobdiff_plain;f=packages%2Flanguage%2Fc%2Flibc%2Fstartup%2Fv2_0%2Fsrc%2Fmain.cxx;h=68b05d17a5338c95714cc78778ddfc43f9309abe;hp=a43723ad5273eada051cfea2656c99d0f9606557;hb=7a4ea0a4d67744fd3f6b5f207d857005fc707b46;hpb=f0c1bd5d9f8457be4a43912a28ca2df207a7f5a4 diff --git a/packages/language/c/libc/startup/v2_0/src/main.cxx b/packages/language/c/libc/startup/v2_0/src/main.cxx index a43723ad..68b05d17 100644 --- a/packages/language/c/libc/startup/v2_0/src/main.cxx +++ b/packages/language/c/libc/startup/v2_0/src/main.cxx @@ -66,6 +66,12 @@ #include // Common tracing support #include // Common assertion support +#ifdef CYGPKG_KERNEL +# include // kernel configuration +# include // For thread suspend +# include +#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);