示例#1
0
int
seaf_wt_monitor_start (SeafWTMonitor *monitor)
{
    if (ccnet_pipe (monitor->cmd_pipe) < 0) {
        seaf_warning ("[wt mon] failed to create command pipe: %s.\n",
                      strerror(errno));
        return -1;
    }

    if (ccnet_pipe (monitor->res_pipe) < 0) {
        seaf_warning ("[wt mon] failed to create result pipe: %s.\n",
                      strerror(errno));
        return -1;
    }

    if (ccnet_job_manager_schedule_job (monitor->seaf->job_mgr,
                                        monitor->job_func,
                                        NULL, monitor) < 0) {
        seaf_warning ("[wt mon] failed to start monitor thread.\n");
        return -1;
    }

    return 0;
}
示例#2
0
文件: job-mgr.c 项目: haiwen/ccnet
int
job_thread_create (CcnetJob *job)
{
    if (ccnet_pipe (job->pipefd) < 0) {
        /* g_warning ("pipe error: %s\n", strerror(errno)); */
        return -1;
    }

    g_thread_pool_push (job->manager->thread_pool, job, NULL);

#ifndef UNIT_TEST
    event_once (job->pipefd[0], EV_READ, job_done_cb, job, NULL);
#endif

    return 0;
}