void erts_sys_main_thread(void) { erts_thread_disable_fpe(); #ifdef __DARWIN__ initialize_darwin_main_thread_pipes(); #endif /* Become signal receiver thread... */ #ifdef ERTS_ENABLE_LOCK_CHECK erts_lc_set_thread_name("signal_receiver"); #endif smp_sig_notify(0); /* Notify initialized */ /* Wait for a signal to arrive... */ #ifdef __DARWIN__ while (1) { /* * The wx driver needs to be able to steal the main thread for Cocoa to * work properly. */ fd_set readfds; int res; FD_ZERO(&readfds); FD_SET(erts_darwin_main_thread_pipe[0], &readfds); res = select(erts_darwin_main_thread_pipe[0] + 1, &readfds, NULL, NULL, NULL); if (res > 0 && FD_ISSET(erts_darwin_main_thread_pipe[0],&readfds)) { void* (*func)(void*); void* arg; void *resp; res = read(erts_darwin_main_thread_pipe[0],&func,sizeof(void* (*)(void*))); if (res != sizeof(void* (*)(void*))) break; res = read(erts_darwin_main_thread_pipe[0],&arg,sizeof(void*)); if (res != sizeof(void*)) break; resp = (*func)(arg); write(erts_darwin_main_thread_result_pipe[1],&resp,sizeof(void *)); } if (res == -1 && errno != EINTR) break; } /* Something broke with the main thread pipe, so we ignore it for now. Most probably erts has closed this pipe and is about to exit. */ #endif /* #ifdef __DARWIN__ */ while (1) { #ifdef DEBUG int res = #else (void) #endif select(0, NULL, NULL, NULL, NULL); ASSERT(res < 0); ASSERT(errno == EINTR); } }
static RETSIGTYPE request_break(int signum) { #ifdef ERTS_SMP smp_sig_notify(signum); #else break_requested(); #endif }
static RETSIGTYPE do_quit(int signum) #endif { #ifdef ERTS_SMP smp_sig_notify('Q'); #else quit_requested(); #endif }
static RETSIGTYPE user_signal1(int signum) #endif { #ifdef ERTS_SMP smp_sig_notify('1'); #else sigusr1_exit(); #endif }
static RETSIGTYPE generic_signal_handler(int signum) { #ifdef ERTS_SMP smp_sig_notify(signum); #else ERTS_SET_SIGNAL_STATE(signum); ERTS_CHK_IO_AS_INTR(); /* Make sure we don't sleep in poll */ #endif }
static RETSIGTYPE generic_signal_handler(int signum) { smp_sig_notify(signum); }
static RETSIGTYPE request_break(int signum) { smp_sig_notify(signum); }