void do_leave_program (void) { graphics_leave (); inputdevice_close (); #ifdef SCSIEMU scsidev_exit (); #endif DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif /* #ifdef CD32 akiko_free (); #endif */ if (! no_gui) gui_exit (); #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); cfgfile_addcfgparam (0); }
/* * Exit emulator */ static void do_exit_machine (void) { graphics_leave (); inputdevice_close (); #ifdef SCSIEMU scsidev_exit (); #endif DISK_free (); audio_close (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CD32 akiko_free (); #endif gui_exit (); #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); hardfile_cleanup (); rtarea_cleanup (); #endif #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); cfgfile_addcfgparam (0); }
void do_leave_program (void) { sampler_free (); graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free (); #endif #ifdef A2091 a2091_free (); a3000scsi_free (); #endif #ifdef NCR ncr710_free(); ncr_free(); #endif #ifdef NCR9X ncr9x_free(); #endif #ifdef CD32 akiko_free (); cd32_fmv_free(); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif gayle_free (); device_func_reset (); #ifdef WITH_LUA uae_lua_free (); #endif savestate_free (); memory_cleanup (); free_shm (); cfgfile_addcfgparam (0); machdep_free (); }
void do_leave_program (void) { #ifdef SAMPLER sampler_free (); #endif graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free (); #endif #ifdef A2091 a2091_free (); #endif #ifdef NCR ncr_free (); #endif #ifdef CD32 akiko_free (); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif #ifdef SCSIEMU #ifdef GAYLE gayle_free (); #endif device_func_reset (); #endif savestate_free (); memory_cleanup (); #ifdef NATMEM_OFFSET free_shm (); #endif cfgfile_addcfgparam (0); machdep_free (); }
void do_leave_program (void) { graphics_leave (); close_joystick (); close_sound (); dump_counts (); zfile_exit (); #ifdef USE_SDL SDL_Quit (); #endif memory_cleanup (); }
void do_leave_program (void) { graphics_leave (); inputdevice_close (); close_sound (); dump_counts (); serial_exit (); zfile_exit (); if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif expansion_cleanup (); memory_cleanup (); }
int uade_main (int argc, char **argv) { quit_program = 0; default_prefs (&currprefs); uade_option (argc, argv); machdep_init (); if (! setup_sound ()) { __android_log_print(ANDROID_LOG_VERBOSE, "UADE", "Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; exit(1); } init_sound(); fix_options (); changed_prefs = currprefs; check_prefs_changed_cpu(); memory_init (); custom_init (); /* Must come after memory_init */ reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ /* compiler_init (); */ if (currprefs.start_debugger) activate_debugger (); m68k_go(); close_sound (); dump_counts (); return 0; }
void Py_Finalize(void) { PyInterpreterState *interp; PyThreadState *tstate; if (!initialized) return; initialized = 0; call_sys_exitfunc(); /* Get current thread state and interpreter pointer */ tstate = PyThreadState_Get(); interp = tstate->interp; /* Disable signal handling */ PyOS_FiniInterrupts(); /* Cleanup Unicode implementation */ _PyUnicode_Fini(); /* Cleanup Codec registry */ _PyCodecRegistry_Fini(); /* Destroy all modules */ PyImport_Cleanup(); /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ _PyImport_Fini(); /* Debugging stuff */ #ifdef COUNT_ALLOCS dump_counts(); #endif #ifdef Py_REF_DEBUG fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); #endif #ifdef Py_TRACE_REFS if ( #ifdef MS_WINDOWS /* Only ask on Windows if env var set */ getenv("PYTHONDUMPREFS") && #endif /* MS_WINDOWS */ _Py_AskYesNo("Print left references?")) { _Py_PrintReferences(stderr); } #endif /* Py_TRACE_REFS */ /* Now we decref the exception classes. After this point nothing can raise an exception. That's okay, because each Fini() method below has been checked to make sure no exceptions are ever raised. */ fini_exceptions(); /* Delete current thread */ PyInterpreterState_Clear(interp); PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp); PyMethod_Fini(); PyFrame_Fini(); PyCFunction_Fini(); PyTuple_Fini(); PyString_Fini(); PyInt_Fini(); PyFloat_Fini(); /* XXX Still allocated: - various static ad-hoc pointers to interned strings - int and float free list blocks - whatever various modules and libraries allocate */ PyGrammar_RemoveAccelerators(&_PyParser_Grammar); call_ll_exitfuncs(); #ifdef Py_TRACE_REFS _Py_ResetReferences(); #endif /* Py_TRACE_REFS */ }
void Py_Finalize(void) { PyInterpreterState *interp; PyThreadState *tstate; if (!initialized) return; /* The interpreter is still entirely intact at this point, and the * exit funcs may be relying on that. In particular, if some thread * or exit func is still waiting to do an import, the import machinery * expects Py_IsInitialized() to return true. So don't say the * interpreter is uninitialized until after the exit funcs have run. * Note that Threading.py uses an exit func to do a join on all the * threads created thru it, so this also protects pending imports in * the threads created via Threading. */ call_sys_exitfunc(); initialized = 0; /* Get current thread state and interpreter pointer */ tstate = PyThreadState_GET(); interp = tstate->interp; /* Disable signal handling */ PyOS_FiniInterrupts(); /* drop module references we saved */ Py_XDECREF(warnings_module); warnings_module = NULL; /* Collect garbage. This may call finalizers; it's nice to call these * before all modules are destroyed. * XXX If a __del__ or weakref callback is triggered here, and tries to * XXX import a module, bad things can happen, because Python no * XXX longer believes it's initialized. * XXX Fatal Python error: Interpreter not initialized (version mismatch?) * XXX is easy to provoke that way. I've also seen, e.g., * XXX Exception exceptions.ImportError: 'No module named sha' * XXX in <function callback at 0x008F5718> ignored * XXX but I'm unclear on exactly how that one happens. In any case, * XXX I haven't seen a real-life report of either of these. */ PyGC_Collect(); #ifdef COUNT_ALLOCS /* With COUNT_ALLOCS, it helps to run GC multiple times: each collection might release some types from the type list, so they become garbage. */ while (PyGC_Collect() > 0) /* nothing */; #endif /* Destroy all modules */ PyImport_Cleanup(); /* Collect final garbage. This disposes of cycles created by * new-style class definitions, for example. * XXX This is disabled because it caused too many problems. If * XXX a __del__ or weakref callback triggers here, Python code has * XXX a hard time running, because even the sys module has been * XXX cleared out (sys.stdout is gone, sys.excepthook is gone, etc). * XXX One symptom is a sequence of information-free messages * XXX coming from threads (if a __del__ or callback is invoked, * XXX other threads can execute too, and any exception they encounter * XXX triggers a comedy of errors as subsystem after subsystem * XXX fails to find what it *expects* to find in sys to help report * XXX the exception and consequent unexpected failures). I've also * XXX seen segfaults then, after adding print statements to the * XXX Python code getting called. */ #if 0 PyGC_Collect(); #endif /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ _PyImport_Fini(); /* Debugging stuff */ #ifdef COUNT_ALLOCS dump_counts(stdout); #endif PRINT_TOTAL_REFS(); #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary * __repr__ overrides, so requires a mostly-intact interpreter. * Alas, a lot of stuff may still be alive now that will be cleaned * up later. */ if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferences(stderr); #endif /* Py_TRACE_REFS */ /* Cleanup auto-thread-state */ #ifdef WITH_THREAD _PyGILState_Fini(); #endif /* WITH_THREAD */ /* Clear interpreter state */ PyInterpreterState_Clear(interp); /* Now we decref the exception classes. After this point nothing can raise an exception. That's okay, because each Fini() method below has been checked to make sure no exceptions are ever raised. */ _PyExc_Fini(); /* Delete current thread */ PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp); /* Sundry finalizers */ PyMethod_Fini(); PyFrame_Fini(); PyCFunction_Fini(); PyTuple_Fini(); PyList_Fini(); PySet_Fini(); PyString_Fini(); PyInt_Fini(); PyFloat_Fini(); #ifdef Py_USING_UNICODE /* Cleanup Unicode implementation */ _PyUnicode_Fini(); #endif /* XXX Still allocated: - various static ad-hoc pointers to interned strings - int and float free list blocks - whatever various modules and libraries allocate */ PyGrammar_RemoveAccelerators(&_PyParser_Grammar); #ifdef Py_TRACE_REFS /* Display addresses (& refcnts) of all objects still alive. * An address can be used to find the repr of the object, printed * above by _Py_PrintReferences. */ if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferenceAddresses(stderr); #endif /* Py_TRACE_REFS */ #ifdef PYMALLOC_DEBUG if (Py_GETENV("PYTHONMALLOCSTATS")) _PyObject_DebugMallocStats(); #endif call_ll_exitfuncs(); }
int Py_FinalizeEx(void) { PyInterpreterState *interp; PyThreadState *tstate; int status = 0; if (!initialized) return status; wait_for_thread_shutdown(); /* The interpreter is still entirely intact at this point, and the * exit funcs may be relying on that. In particular, if some thread * or exit func is still waiting to do an import, the import machinery * expects Py_IsInitialized() to return true. So don't say the * interpreter is uninitialized until after the exit funcs have run. * Note that Threading.py uses an exit func to do a join on all the * threads created thru it, so this also protects pending imports in * the threads created via Threading. */ call_py_exitfuncs(); /* Get current thread state and interpreter pointer */ tstate = PyThreadState_GET(); interp = tstate->interp; /* Remaining threads (e.g. daemon threads) will automatically exit after taking the GIL (in PyEval_RestoreThread()). */ _Py_Finalizing = tstate; initialized = 0; /* Flush sys.stdout and sys.stderr */ if (flush_std_files() < 0) { status = -1; } /* Disable signal handling */ PyOS_FiniInterrupts(); /* Collect garbage. This may call finalizers; it's nice to call these * before all modules are destroyed. * XXX If a __del__ or weakref callback is triggered here, and tries to * XXX import a module, bad things can happen, because Python no * XXX longer believes it's initialized. * XXX Fatal Python error: Interpreter not initialized (version mismatch?) * XXX is easy to provoke that way. I've also seen, e.g., * XXX Exception exceptions.ImportError: 'No module named sha' * XXX in <function callback at 0x008F5718> ignored * XXX but I'm unclear on exactly how that one happens. In any case, * XXX I haven't seen a real-life report of either of these. */ PyGC_Collect(); #ifdef COUNT_ALLOCS /* With COUNT_ALLOCS, it helps to run GC multiple times: each collection might release some types from the type list, so they become garbage. */ while (PyGC_Collect() > 0) /* nothing */; #endif /* Destroy all modules */ PyImport_Cleanup(); /* Flush sys.stdout and sys.stderr (again, in case more was printed) */ if (flush_std_files() < 0) { status = -1; } /* Collect final garbage. This disposes of cycles created by * class definitions, for example. * XXX This is disabled because it caused too many problems. If * XXX a __del__ or weakref callback triggers here, Python code has * XXX a hard time running, because even the sys module has been * XXX cleared out (sys.stdout is gone, sys.excepthook is gone, etc). * XXX One symptom is a sequence of information-free messages * XXX coming from threads (if a __del__ or callback is invoked, * XXX other threads can execute too, and any exception they encounter * XXX triggers a comedy of errors as subsystem after subsystem * XXX fails to find what it *expects* to find in sys to help report * XXX the exception and consequent unexpected failures). I've also * XXX seen segfaults then, after adding print statements to the * XXX Python code getting called. */ #if 0 PyGC_Collect(); #endif /* Disable tracemalloc after all Python objects have been destroyed, so it is possible to use tracemalloc in objects destructor. */ _PyTraceMalloc_Fini(); /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ _PyImport_Fini(); /* Cleanup typeobject.c's internal caches. */ _PyType_Fini(); /* unload faulthandler module */ _PyFaulthandler_Fini(); /* Debugging stuff */ #ifdef COUNT_ALLOCS dump_counts(stderr); #endif /* dump hash stats */ _PyHash_Fini(); _PY_DEBUG_PRINT_TOTAL_REFS(); #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary * __repr__ overrides, so requires a mostly-intact interpreter. * Alas, a lot of stuff may still be alive now that will be cleaned * up later. */ if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferences(stderr); #endif /* Py_TRACE_REFS */ /* Clear interpreter state and all thread states. */ PyInterpreterState_Clear(interp); /* Now we decref the exception classes. After this point nothing can raise an exception. That's okay, because each Fini() method below has been checked to make sure no exceptions are ever raised. */ _PyExc_Fini(); /* Sundry finalizers */ PyMethod_Fini(); PyFrame_Fini(); PyCFunction_Fini(); PyTuple_Fini(); PyList_Fini(); PySet_Fini(); PyBytes_Fini(); PyByteArray_Fini(); PyLong_Fini(); PyFloat_Fini(); PyDict_Fini(); PySlice_Fini(); _PyGC_Fini(); _PyRandom_Fini(); _PyArg_Fini(); /* Cleanup Unicode implementation */ _PyUnicode_Fini(); /* reset file system default encoding */ if (!Py_HasFileSystemDefaultEncoding && Py_FileSystemDefaultEncoding) { PyMem_RawFree((char*)Py_FileSystemDefaultEncoding); Py_FileSystemDefaultEncoding = NULL; } /* XXX Still allocated: - various static ad-hoc pointers to interned strings - int and float free list blocks - whatever various modules and libraries allocate */ PyGrammar_RemoveAccelerators(&_PyParser_Grammar); /* Cleanup auto-thread-state */ #ifdef WITH_THREAD _PyGILState_Fini(); #endif /* WITH_THREAD */ /* Delete current thread. After this, many C API calls become crashy. */ PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp); #ifdef Py_TRACE_REFS /* Display addresses (& refcnts) of all objects still alive. * An address can be used to find the repr of the object, printed * above by _Py_PrintReferences. */ if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferenceAddresses(stderr); #endif /* Py_TRACE_REFS */ #ifdef WITH_PYMALLOC if (_PyMem_PymallocEnabled()) { char *opt = Py_GETENV("PYTHONMALLOCSTATS"); if (opt != NULL && *opt != '\0') _PyObject_DebugMallocStats(stderr); } #endif call_ll_exitfuncs(); return status; }
void do_leave_program (void) { sampler_free (); graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef PARALLEL_PORT parallel_exit(); #endif #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free(); cdtvcr_free(); #endif #ifdef A2091 a2091_free (); gvp_free (); a3000scsi_free (); #endif soft_scsi_free(); #ifdef NCR ncr_free(); #endif #ifdef NCR9X ncr9x_free(); #endif #ifdef CD32 akiko_free (); cd32_fmv_free(); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef WITH_PCI pci_free(); #endif #ifdef WITH_X86 x86_bridge_free(); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif gayle_free (); idecontroller_free(); device_func_reset (); #ifdef WITH_LUA uae_lua_free (); #endif #ifdef WITH_PPC uae_ppc_free(); #endif #ifdef WITH_TOCCATA sndboard_free(); #endif gfxboard_free(); #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); free_shm (); cfgfile_addcfgparam (0); machdep_free (); #ifdef DRIVESOUND driveclick_free(); #endif ethernet_enumerate_free(); }