1 /* -----------------------------------------------------------------------------
2 * $Id: Main.c,v 1.2 1998/12/02 13:28:30 simonm Exp $
4 * Main function for a standalone Haskell program.
6 * ---------------------------------------------------------------------------*/
10 #include "Schedule.h" /* for MainTSO */
14 #include "RtsFlags.h" /* for debugging flags */
15 #include "Printer.h" /* for printing */
19 #include "Assembler.h"
28 /* Hack: we assume that we're building a batch-mode system unless
31 #ifndef INTERPRETER /* Hack */
32 int main(int argc, char *argv[])
34 SchedulerStatus status;
35 startupHaskell(argc,argv);
38 MainTSO = createIOThread(BLOCK_SIZE_W,(StgClosure *)&mainIO_closure);
39 status = schedule(MainTSO,NULL);
41 if (IAmMainThread == rtsTrue) {
42 /*Just to show we're alive */
43 fprintf(stderr, "Main Thread Started ...\n");
45 MainTSO = createIOThread(BLOCK_SIZE_W,(StgClosure *)&mainIO_closure);
46 status = schedule(MainTSO,NULL);
48 WaitForPEOp(PP_FINISH,SysManTask);
54 barf("Scheduler stopped, all threads blocked");
57 barf("No threads to run! Deadlock?");
59 belch("%s: warning: main thread killed", prog_argv[0]);
65 stg_exit(EXIT_SUCCESS);
67 #endif /* BATCH_MODE */