Exemple #1
0
status_t task_daemon_run(osa_console_object_t *pobj)
{
    msg_t *msg = NULL;
    status_t status   = OSA_SOK;
    task_state_t state = TASK_STATE_PROC;

    glb_tsk_mgr_exit = 0;
    signal(SIGINT, osa_console_test_signal_handler);

    while (!glb_tsk_mgr_exit) {

        status = task_wait_msg(pobj->m_task_obj.m_task, &msg, MSG_TYPE_CMD);

        if (OSA_ISERROR(status)) {
            continue;
        }

        status |= __vcs_daemon_do_process(pobj, pobj->m_task_obj.m_task, msg);

        status |= task_ack_free_msg(pobj->m_task_obj.m_task, msg);

        if (!OSA_ISERROR(task_get_state(pobj->m_task_obj.m_task, &state))
                && state == TASK_STATE_EXIT) {
            break;
        }
    }

    return status;
}
Exemple #2
0
void
stask_wake(sched_task_t stask, executor_t exec)
{ 
  assert(exec != NULL);
  assert(stask != NULL);
  while(task_get_state(stask->task) != TASK_WAITING);
  task_set_state(stask->task, TASK_RUNNABLE);
  exec_push(exec, stask);
  /* sync_data_enqueue_runnable(proc->task->sync_data, proc); */
}
Exemple #3
0
static status_t task_do_process(HANDLE hdl, task_t tsk, msg_t **msg)
{
    status_t status = OSA_SOK;
    unsigned int msg_cnt = 0;
    task_state_t tsk_state = TASK_STATE_PROC;

    task_driver_test5_object_t * tsk_hdl = NULL;

    tsk_hdl = (task_driver_test5_object_t *)hdl;

    OSA_assert((void *)tsk_hdl != NULL);

    DBG(DBG_INFO, "task_do_process: %s do processed.\n", tsk_hdl->m_name);

    /*
     *  Note: if we do not return from this routine, ack the msg first.
     */
    msg_set_status(*msg, OSA_SOK);
    status = task_ack_free_msg(tsk, *msg);

    (*msg) = NULL;

    while (!OSA_ISERROR(task_get_state(tsk, &tsk_state))
            && tsk_state != TASK_STATE_EXIT) {

        /*
         *   Do the task.
         */
#if defined(TASK_MGR_DEBUG)
        fprintf(stderr, "task_do_process: TASK[0x%x]: %s is running...\n", tsk, tsk_hdl->m_name);
#endif  // if defined TASK_MGR_DEBUG

        usleep(5000);

        status |= task_synchronize(tsk, task_do_synchronize, msg_cnt, (void *)hdl);
    }

    while (task_check_state(tsk))
    return status;
}