示例#1
0
文件: ae.c 项目: flygoast/verben
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);
}
示例#2
0
static void benchmark(char *title, char *content, int len) {
    client  *c;
    conf.title = title;
    conf.requests_issued = 0;
    conf.requests_finished = 0;

    c = create_client(content, len);
    create_missing_clients(c);

    conf.start = mstime();
    ae_main(conf.el, &quit);
    conf.total_latency = mstime() - conf.start;

    show_latency_report();
    free_all_clients();
}
示例#3
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;
}
示例#4
0
文件: ae_main.c 项目: linfanps/gist
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;
}