Exemple #1
0
/* wakeup */
void procthread_wakeup(PROCTHREAD *pth)
{
    if(pth)
    {
        if(pth->have_evbase && pth->evbase)
        {
            MUTEX_LOCK(pth->mutex);
            if(pth->flag == 0) 
            {
                pth->flag = 1;
                event_add(&(pth->event), E_WRITE);
            }
            MUTEX_UNLOCK(pth->mutex);
        }
        else
        {
            if(pth->service->flag & SB_USE_EVSIG)
            {
                evsig_wakeup(&(pth->evsig));
            }
            else if(pth->service->flag & SB_USE_COND)
            {
                MUTEX_SIGNAL(pth->mutex);
            }
        }
    }
    return ;
}
Exemple #2
0
/* push new taskid */
int wtable_new_task(WTABLE *w, int wid, int taskid)
{
    int ret = 0;

    if(w && wid > 0 && wid < W_WORKER_MAX)
    {
        mqueue_push(w->queue, w->workers[wid].task_qid, taskid);
        MUTEX_SIGNAL(w->workers[wid].mmlock);
    }
    return ret;
}