コード例 #1
0
ファイル: udp.c プロジェクト: hmatyschok/MeshBSD
static int
spmd_add_resolver_task(struct resolver_sock *rshead)
{
    struct task *t;
    struct resolver_sock *rs = NULL;


    if (!rshead) {
        SPMD_PLOG(SPMD_L_INTERR, "Argument rshead is NULL");
        return -1;
    }

    rs = rshead;

    while (rs) {
        t = task_alloc(MAX_UDP_DNS_SIZE);
        t->fd = rs->s;
        t->flags = 0;
        t->sa = &rs->sock.sa;
        t->salen = sizeof(rs->sock);/* cant use SPMD_SALEN() */
        t->func = query_recv;
        task_list_add(t, &spmd_task_root->read);
        rs = rs->next;
    }

    return 0;
}
コード例 #2
0
ファイル: sched.c プロジェクト: Fluray/sbunix
/**
 * Add a newly created task to the system.
 * Adds it to the list of all tasks and to the appropriate queue.
 */
void task_add_new(struct task_struct *task) {
    if(!task)
        return;
    task_list_add(task);
    queue_add_by_state(task);
}