void NetlinkProtocol::start() { if (!running_) { running_ = true; tx_thread_.start([this] () { tx_loop(); }); rx_thread_.start([this] () { rx_loop(); }); } }
/* * rx_main() * */ void rx_main(void) { signal(SIGINT, SIG_IGN); /* ignore crtl-c */ signal(SIGHUP, SIG_IGN); /* we get them from sshd sometimes */ if (login_shell) signal(SIGTSTP, SIG_IGN); /* ignore crtl-z */ return rx_exit(rx_loop(), "rx_loop returned."); }
void AsyncProtocol::start() { if (running_) { return; } running_ = true; Application::subscribe([&] (const event::Quit& /*event*/) { stop(); }); register_messages(); rx_thread_.start([this] () { rx_loop(); }); tx_thread_.start([this] () { tx_loop(); }); }
int main(int argc, char *argv[]) { int ret; parse_args(argc, argv); if (the_working_paras.cpu_idx!=(uint8_t)-1) { ret = bind_cur_thread_to_cpu(the_working_paras.cpu_idx); if (0==ret) goto BIND_CPU_OK; errno = ret; ERR_DBG_PRINT_QUIT("bind to cpu %d failed", (int)the_working_paras.cpu_idx); } BIND_CPU_OK: register_sig_proc(SIGINT, sig_handler); register_sig_proc(SIGALRM, sig_handler); connect2dst(); alarm(the_working_paras.snd_interval); rx_loop(); show_stats(); return 0; }