Exemplo n.º 1
0
//----------------------------------------------------------------//
static void _cleanup () {

	// TODO:
	// don't call this on windows; atexit conflict with untz
	// possible to fix?
	//AKUClearMemPool ();
	
	#if MOAI_WITH_BOX2D
		AKUFinalizeBox2D ();
	#endif
	
	#if MOAI_WITH_CHIPMUNK
		AKUFinalizeChipmunk ();
	#endif
	
	#if MOAI_WITH_HTTP_CLIENT
		AKUFinalizeHttpClient ();
	#endif

	AKUFinalizeUtil ();
	AKUFinalizeSim ();
	AKUFinalize ();
	
  // if ( sDynamicallyReevaluateLuaFiles ) {
  //  #ifdef _WIN32
  //    winhostext_CleanUp ();
  //  #elif __APPLE__
  //    FWStopAll ();
  //  #endif
  // }
}
Exemplo n.º 2
0
//----------------------------------------------------------------//
int main ( int argc, char *argv []) {

	AKUCreateContext ();
	AKUInitializeUtil ();
	AKUInitializeHttpServer ();

	// Setup signal handler: quit on Ctrl-C
	signal ( SIGTERM, signal_handler );
	signal ( SIGINT, signal_handler );
	
	AKUSetArgv ( argv );
	
	for ( int i = 1; i < argc; ++i ) {
		char* arg = argv [ i ];
		if ( strcmp( arg, "-s" ) == 0 && ++i < argc ) {
			AKURunString ( argv [ i ]);
		}
		else {
			AKURunScript ( arg );
		}
	}
	
	while ( sExitFlag == 0 ) {
		sleep ( 1 );
	}
	printf ( "Exiting on signal %d, waiting for all threads to finish...", sExitFlag );
	fflush ( stdout );
	
	AKUFinalizeUtil ();
	AKUFinalizeHttpServer ();
	AKUFinalize ();
	
	printf ( "%s", " done.\n" );

	return EXIT_SUCCESS;
}