Exemple #1
0
void _opque_start_execution(opque_t *que)
{
    int n, i;
    callback_t *cb;
    op_generic_t *gop;
    que_data_t *q = &(que->qd);

    gop = opque_get_gop(que);
    if (gop->base.started_execution != 0) {
        return;
    }

    gop->base.started_execution = 1;

    n = stack_size(q->list);
    move_to_top(q->list);
    for (i=0; i<n; i++) {
        cb = (callback_t *)pop(q->list);
        gop = (op_generic_t *)cb->priv;
        if (gop->type == Q_TYPE_OPERATION) {
            log_printf(15, "qid=%d gid=%d\n",gop_id(opque_get_gop(que)), gop_get_id(gop));
            gop->base.started_execution = 1;
            gop->base.pc->fn->submit(gop->base.pc->arg, gop);
        } else {  //** It's a queue
            log_printf(15, "qid=%d Q gid=%d\n",gop_id(opque_get_gop(que)), gop_get_id(gop));
            lock_opque(gop->q);
            _opque_start_execution(gop->q->opque);
            unlock_opque(gop->q);
        }
    }

//  unlock_opque(q);
}
Exemple #2
0
void _gop_start_execution(op_generic_t *g)
{
    if (gop_get_type(g) == Q_TYPE_QUE) {
        _opque_start_execution(g->q->opque);
    } else if (g->base.started_execution == 0) {
        log_printf(15, "gid=%d started_execution=%d\n", gop_get_id(g), g->base.started_execution);
        g->base.started_execution = 1;
        g->base.pc->fn->submit(g->base.pc->arg, g);
    }
}