int main(int argc, char *argv[]) { long long id; ae_event_loop *el = ae_create_event_loop(); add_all(el); ae_main(el); delete_all(el); exit(0); }
int main(int argc, char * argv[]) { ae_event_loop * ev_lp = ae_create_event_loop(1024); // ae_create_time_event(ev_lp, 1000, time_loop, NULL, NULL); int retv; retv = mkfifo("tmp.fifo", O_RDWR); int readfd = open("tmp.fifo", O_RDWR | O_NONBLOCK); retv = ae_create_file_event(ev_lp, readfd, AE_READABLE, handle_func, NULL, NULL); if (retv == AE_ERR) { printf("create listen fifo event failed"); return -1; } chmod("tmp.fifo", S_IRWXU | S_IRWXG | S_IRWXO); ae_main(ev_lp); return 0; }
int main(int argc, char **argv) { int listenfd; ae_event_loop *ev_loop; if ((ev_loop = ae_create_event_loop(SETSIZE)) == NULL) { printf("create event loop failed\n"); return -1; } if ((listenfd = create_listen_fd(1000)) == -1) { ae_delete_event_loop(ev_loop); return -1; } if (ae_create_file_event(ev_loop, listenfd, AE_READABLE, accept_tcp_handler, NULL) == AE_ERR) { printf("create listenfd event failed\n"); } ae_main(ev_loop); return 0; }
int main(int argc, char **argv) { signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); conf.num_clients = 50; conf.requests = 10000; conf.live_clients = 0; conf.keep_alive = 1; conf.loop = 0; conf.quiet = 0; conf.el = ae_create_event_loop(); ae_create_time_event(conf.el, 1, show_throughput, NULL, NULL); conf.clients = dlist_init(); conf.hostip = "127.0.0.1"; conf.hostport = 8773; parse_options(argc, argv); if (optind < argc) { usage(1); } if (!conf.keep_alive) { puts("WARNING:\n" " keepalive disabled, at linux, you probably need \n" " 'echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse' and \n" " 'sudo sysctl -w net.inet.tcp.msl=1000' for Mac OS X\n" " in order to use a lot of clients/requests\n"); } do { benchmark("QPS benchmark", "hello\r\n", 7); } while (conf.loop); exit(0); }