예제 #1
0
void clean_exit(int sig_num) {
    void *array[10];
    size_t size;

    // close files
    for (int id_joystick = 0; id_joystick <= 3; ++id_joystick)
        if (js[id_joystick].file_descriptor >= 0) close(js[id_joystick].file_descriptor);
    if (kbfd>=0) close(kbfd);
    if(audio_fd>=0) close(audio_fd);

    // Close EGL context ???
    if (sig_num!=0)
        gl_term();

    // close XWindow
    if (x11_win) {
        XDestroyWindow(x11_disp, x11_win);
        x11_win = 0;
    }
    if (x11_disp) {
        XCloseDisplay(x11_disp);
        x11_disp = 0;
    }

    // finish cleaning
    if (sig_num!=0) {
        write(2, "\nSignal received\n", sizeof("\nSignal received\n"));

        size = backtrace(array, 10);
        backtrace_symbols_fd(array, size, STDERR_FILENO);
        exit(1);
    }
}
예제 #2
0
void clean_exit(int sig_num) {
	void *array[10];
	size_t size;
	
	// close files
	if (JoySDL) 		SDL_JoystickClose(JoySDL);
	#ifdef USE_OSS
	if (audio_fd>=0) 	close(audio_fd);
	#endif

	// Close EGL context ???
	if (sig_num!=0)
		gl_term();

	SDL_Quit();
}
예제 #3
0
  void clean_exit(int sig_num)
  {
    void* array[10];
    size_t size;

    // close files
    if (JoyFD >= 0) { close(JoyFD); }
    if (kbfd >= 0) { close(kbfd); }

    // Close EGL context ???
    if (sig_num!=0)
    {
      gl_term();
    }

    // close XWindow
    if (x11_win)
    {
      XDestroyWindow(x11_disp, x11_win);
      x11_win = 0;
    }
    if (x11_disp)
    {
      XCloseDisplay(x11_disp);
      x11_disp = 0;
    }

    // finish cleaning
    if (sig_num!=0)
    {
      write(2, "\nSignal received\n", sizeof("\nSignal received\n"));

      size = backtrace(array, 10);
      backtrace_symbols_fd(array, size, STDERR_FILENO);
      exit(1);
    }
  }