Exemplo n.º 1
0
/* main loop for checking worker */
void monitor_loop() {

    /* maintain the population */
    while (1) {
        /* check number of workers every second */
        sleep(GM_DEFAULT_WORKER_LOOP_SLEEP);

        /* make sure our worker are running */
        check_worker_population();
    }
    return;
}
Exemplo n.º 2
0
/* main loop for checking worker */
void monitor_loop() {
    int status;

    /* maintain the population */
    while (1) {
        /* check number of workers every second */
        sleep(GM_DEFAULT_WORKER_LOOP_SLEEP);

        /* collect finished workers */
        while(waitpid(-1, &status, WNOHANG) > 0)
            gm_log( GM_LOG_TRACE, "waitpid() worker exited with: %d\n", status);

        check_worker_population();
    }
    return;
}
Exemplo n.º 3
0
/* try to reload the config */
void reload_config(int sig) {
    gm_log( GM_LOG_TRACE, "reload_config(%d)\n", sig);
    if(parse_arguments(orig_argc, orig_argv) != GM_OK) {
        gm_log( GM_LOG_ERROR, "reload config failed, check your config\n");
        return;
    }

    /*
     * restart workers gracefully:
     * send term signal to our children
     * children will finish the current job and exit
     */
    stop_children(GM_WORKER_RESTART);

    /* start status worker */
    make_new_child(GM_WORKER_STATUS);

    /* start normal worker */
    check_worker_population();

    gm_log( GM_LOG_INFO, "reloading config was successful\n");

    return;
}