X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FMain.c;h=5f16fa344ab730686095fb663af40cdeeb5c517c;hb=006a18ea83799c0d4255071a2f8c08d3e9c7d84f;hp=6738a1cbb9a1212c602650b6c16c639d107e12b7;hpb=ab0e778ccfde61aed4c22679b24d175fc6cc9bf3;p=ghc-hetmet.git diff --git a/rts/Main.c b/rts/Main.c index 6738a1c..5f16fa3 100644 --- a/rts/Main.c +++ b/rts/Main.c @@ -16,6 +16,7 @@ #include "RtsUtils.h" #include "Prelude.h" #include "Task.h" +#include "seh_excn.h" #include #ifdef DEBUG @@ -48,6 +49,7 @@ int main(int argc, char *argv[]) SchedulerStatus status; /* all GranSim/GUM init is done in startupHaskell; sets IAmMainThread! */ + BEGIN_CATCH startupHaskell(argc,argv,__stginit_ZCMain); /* kick off the computation by creating the main thread with a pointer @@ -101,7 +103,7 @@ int main(int argc, char *argv[]) /* ToDo: want to start with a larger stack size */ { - void *cap = rts_lock(); + Capability *cap = rts_lock(); cap = rts_evalLazyIO(cap,(HaskellObj)(void *)mainIO_closure, NULL); status = rts_getSchedStatus(cap); taskTimeStamp(myTask()); @@ -133,6 +135,8 @@ int main(int argc, char *argv[]) barf("main thread completed with invalid status"); } shutdownHaskellAndExit(exit_status); - return 0; /* never reached, keep gcc -Wall happy */ + END_CATCH + return 0; /* not reached unless a Windows exception happens, + also keeps gcc -Wall happy */ } # endif /* BATCH_MODE */