Example #1
0
static int other_simple_jobs()
{
    coevnet_module_do_other_jobs();
    sync_serv_status();
#ifdef SMPDEBUG

    if(now - dump_smp_link_time > 60) {
        dump_smp_link_time = now;
        dump_smp_link();
    }

#endif

    if(++flush_logs_timer > 100) {
        flush_logs_timer = 0;
        sync_logs(LOGF_T);
        sync_logs(ACCESS_LOG);
    }

    return 1; // return 0 will be exit the worker
}
Example #2
0
File: log.c Project: dolfly/merry
void log_destory(logf_t *_logf)
{
    if(!_logf) {
        return;
    }

    sync_logs(_logf);
    free(_logf->file);
    _logf->file = NULL;
    shm_free(_logf->_shm_log_buf);
    _logf->_shm_log_buf = NULL;

    if(_logf->LOG_FD != -1) {
        close(_logf->LOG_FD);
        _logf->LOG_FD = -1;
    }
}
Example #3
0
static void on_exit_handler()
{
    if(exited) {
        return;
    }

    now += 10;
    serv_status.waiting_counts = 0;
    serv_status.reading_counts = 0;
    serv_status.sending_counts = 0;
    serv_status.active_counts = 0;
    sync_serv_status();

    exited = 1;
    sync_logs(ACCESS_LOG);
    LOGF(ALERT, "worker %d exited", worker_n);

    if(getarg("gcore") && !check_process_for_exit()) {
        char cmd[50] = {0};
        sprintf(cmd, "gcore -o dump %u", getpid());
        system(cmd);
    }
}