static void osd_exit(running_machine *machine) { // take down the watchdog thread if it exists if (watchdog_thread != NULL) { SetEvent(watchdog_exit_event); WaitForSingleObject(watchdog_thread, INFINITE); CloseHandle(watchdog_reset_event); CloseHandle(watchdog_exit_event); CloseHandle(watchdog_thread); watchdog_reset_event = NULL; watchdog_exit_event = NULL; watchdog_thread = NULL; } stop_profiler(); // turn off our multimedia tasks // if (av_revert_mm_thread_characteristics != NULL) // (*av_revert_mm_thread_characteristics)(mm_task); // restore the timer resolution if (timeresult == TIMERR_NOERROR) timeEndPeriod(caps.wPeriodMin); // one last pass at events winwindow_process_events(machine, 0); }
static void osd_exit(running_machine *machine) { stop_profiler(); // turn off our multimedia tasks // if (av_revert_mm_thread_characteristics != NULL) // (*av_revert_mm_thread_characteristics)(mm_task); // restore the timer resolution if (timeresult == TIMERR_NOERROR) timeEndPeriod(caps.wPeriodMin); // one last pass at events winwindow_process_events(0); }
int start_profiler(int interval) { int i; if (is_running) { stop_profiler(); } is_running = true; pow[0] = 1, hash_array[0] = 0; for (i = 1; i < SAMPLE_HASH_SIZE; i++) { pow[i] = (pow[i - 1] * base) % SAMPLE_HASH_SIZE; /* initialize hash */ hash_array[i] = 0; } sampling_profiler_set(interval); return ENOERR; }
int utf8_main(int argc, char **argv) { int game_index; char *ext; int res = 0; HMODULE library; // initialize common controls InitCommonControls(); // set up exception handling pass_thru_filter = SetUnhandledExceptionFilter(exception_filter); #ifndef WINUI // check for double-clicky starts if (check_for_double_click_start(argc) != 0) return 1; #endif // see if we can use TryEnterCriticalSection try_enter_critical_section = NULL; library = LoadLibrary(TEXT("kernel32.dll")); if (library != NULL) try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection"); strcpy(mapfile_name, argv[0]); ext = strchr(mapfile_name, '.'); if (ext) strcpy(ext, ".map"); else strcat(mapfile_name, ".map"); // parse config and cmdline options game_index = cli_frontend_init(argc, argv); // have we decided on a game? if (game_index != -1) { TIMECAPS caps; MMRESULT result; // crank up the multimedia timer resolution to its max // this gives the system much finer timeslices result = timeGetDevCaps(&caps, sizeof(caps)); if (result == TIMERR_NOERROR) timeBeginPeriod(caps.wPeriodMin); start_profiler(); // run the game res = run_game(game_index); stop_profiler(); // restore the timer resolution if (result == TIMERR_NOERROR) timeEndPeriod(caps.wPeriodMin); } // one last pass at events winwindow_process_events(0); // close errorlog, input and playback cli_frontend_exit(); return res; }