obs-studio跨平台实现学习日志

ifndef _WIN32
signal(SIGPIPE, SIG_IGN);

struct sigaction sig_handler;

sig_handler.sa_handler = ctrlc_handler;
sigemptyset(&sig_handler.sa_mask);
sig_handler.sa_flags = 0;

sigaction(SIGINT, &sig_handler, NULL);

/* Block SIGPIPE in all threads, this can happen if a thread calls write on
a closed pipe. */
sigset_t sigpipe_mask;
sigemptyset(&sigpipe_mask);
sigaddset(&sigpipe_mask, SIGPIPE);
sigset_t saved_mask;
if (pthread_sigmask(SIG_BLOCK, &sigpipe_mask, &saved_mask) == -1) {
	perror("pthread_sigmask");
	exit(1);
}

#endif

#ifdef _WIN32
obs_init_win32_crash_handler();
SetErrorMode(SEM_FAILCRITICALERRORS);
load_debug_privilege();
base_set_crash_handler(main_crash_handler, nullptr);
#endif

base_get_log_handler(&def_log_handler, nullptr);

#if defined(USE_XDG) && defined(IS_UNIX)
move_to_xdg();
#endif

你可能感兴趣的:(obs-studio跨平台实现学习日志)