gint main (gint argc, gchar **argv) { cli_infos_t *cli_infos; setlocale (LC_ALL, ""); cli_infos = cli_infos_init (argc - 1, argv + 1); /* Execute command, if connection status is ok */ if (cli_infos) { if (cli_infos->mode == CLI_EXECUTION_MODE_INLINE) { loop_once (cli_infos, argc - 1, argv + 1); } else { gchar *filename; filename = configuration_get_string (cli_infos->config, "HISTORY_FILE"); read_history (filename); using_history (); loop_run (cli_infos); write_history (filename); } } cli_infos_free (cli_infos); return 0; }
int main(void) { struct json_object *cmd; engine_callback = main_callback; if (engine_init() < 0) exit(1); signal(SIGINT, stop_loop); loop_init(); initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); win_body_lines = LINES - 8; // If you don't do this, the service config form won't be displayed while (win_body_lines % 4 != 3) win_body_lines--; win_body = newwin(win_body_lines + 2, COLS, 2, 0); box(win_body, 0 , 0); keypad(win_body, TRUE); win_header = newwin(2, COLS, 0, 0); win_footer = newwin(2, COLS, LINES-2, 0); // Print all windows, according to the man it's more efficient than 3 wnoutrefresh(win_header); wnoutrefresh(win_body); wnoutrefresh(win_footer); doupdate(); context.current_context = CONTEXT_HOME; context.serv = malloc(sizeof(struct userptr_data)); assert(context.serv != NULL); context.tech = malloc(sizeof(struct userptr_data)); assert(context.tech != NULL); // get_home_page (and render it) cmd = json_object_new_object(); json_object_object_add(cmd, key_command, json_object_new_string("get_home_page")); engine_query(cmd); loop_run(true); loop_terminate(); delwin(win_header); delwin(win_body); delwin(win_footer); endwin(); return 0; }
gint main (gint argc, gchar **argv) { cli_infos_t *cli_infos; cli_infos = cli_infos_init (argc - 1, argv + 1); /* Execute command, if connection status is ok */ if (cli_infos) { if (cli_infos->mode == CLI_EXECUTION_MODE_INLINE) { loop_once (cli_infos, argc - 1, argv + 1); } else { loop_run (cli_infos); } } cli_infos_free (cli_infos); return 0; }
int main() { int i = 0; loop_t* loop = loop_create(); channel_ref_t* acceptor = 0; channel_ref_t* connector = 0; acceptor = loop_create_channel(loop, 8, 1024); channel_ref_accept(acceptor, 0, 8000, 50); channel_ref_set_cb(acceptor, acceptor_cb); broadcast = broadcast_create(); for (; i < MAX_CONNECTOR; i++) { connector = loop_create_channel(loop, 8, 1024); channel_ref_set_cb(connector, connector_cb); channel_ref_connect(connector, "127.0.0.1", 8000, 0); } loop_run(loop); broadcast_destroy(broadcast); loop_destroy(loop); return 0; }
int main(int argc, char **argv){ misc_init(); argc_ = argc; argv_ = argv; init(menu()); for(uint_ i = 0;i < server_loop_code->code.size();i++){ try{ loop_entry_t *tmp = (loop_entry_t*)find_pointer(server_loop_code->code[i]); throw_if_nullptr(tmp); tmp->settings = 0; }catch(const std::logic_error &e){} } printf("Starting the main loop\n"); while(likely(check_signal(SIGINT) == false && check_signal(SIGKILL) == false && check_signal(SIGTERM) == false)){ loop_run(server_loop_code); once_per_second_update(); if(once_per_second){ server_time->update_timestamp(); // Should I make a new thread for this or is it good enough here w/ hangs? } } close(); last_thing_to_execute(); return 0; }
static void lcb_io_run_event_loop(struct lcb_io_opt_st *iops) { rb_mt_loop *loop = iops->v.v0.cookie; loop_run(loop); }
void net_engine(){ net->loop(); //SET_BIT(net_loop_settings, LOOP_CODE_MT, 1); loop_run(&net_loop_code, &net_loop_settings); }