Пример #1
0
void complete_all_asyncio(){
	while(reqs)
		check_reqs();
}
Пример #2
0
void backend()
{
    struct timeval timeout;
    int i, nb;
    volatile int first_call = 1;
    int there_is_a_port = 0;
    error_context_t econ;

    debug_message("Initializations complete.\n\n");
    for (i = 0; i < 5; i++) {
        if (external_port[i].port) {
            debug_message("Accepting connections on port %d.\n",
                    external_port[i].port);
            there_is_a_port = 1;
        }
    }

    if (!there_is_a_port)
        debug_message("No external ports specified.\n");

    init_user_conn();   /* initialize user connection socket */
#ifdef SIGHUP
    signal(SIGHUP, startshutdownMudOS);
#endif
    clear_state();
    save_context(&econ);
    if (SETJMP(econ.context))
        restore_context(&econ);
    if (!t_flag && first_call) {
        first_call = 0;
        call_heart_beat();
    }

    while (1) {
        /* Has to be cleared if we jumped out of process_user_command() */
        current_interactive = 0;
        set_eval(max_cost);

        if (obj_list_replace || obj_list_destruct)
            remove_destructed_objects();

        /*
         * shut down MudOS if MudOS_is_being_shut_down is set.
         */
        if (MudOS_is_being_shut_down)
            shutdownMudOS(0);
        if (slow_shut_down_to_do) {
            int tmp = slow_shut_down_to_do;

            slow_shut_down_to_do = 0;
            slow_shut_down(tmp);
        }
        /*
         * select
         */
        make_selectmasks();
        timeout.tv_sec = 1;
        timeout.tv_usec = 0;
#ifndef hpux
        nb = select(FD_SETSIZE, &readmask, &writemask, (fd_set *) 0, &timeout);
#else
        nb = select(FD_SETSIZE, (int *) &readmask, (int *) &writemask,
                (int *) 0, &timeout);
#endif
        /*
         * process I/O if necessary.
         */
        if (nb > 0) {
            process_io();
        }
        /*
         * process user commands.
         */
        for (i = 0; process_user_command() && i < max_users; i++)
            ;

        /*
         * call outs
         */
        call_out();
#ifdef PACKAGE_ASYNC
        check_reqs();
#endif
    }
}       /* backend() */