Exemplo n.º 1
0
/*
 *  ======== Lck_Instance_finalize ========
 */
Void Lck_Instance_finalize(Lck_Object *obj )
{
    Semaphore_Handle sem;

    sem = Lck_Instance_State_sem(obj);
    Semaphore_destruct(Semaphore_struct(sem));
}
Exemplo n.º 2
0
/*
 *  ======== GateMutex_Instance_finalize ========
 */
Void GateMutex_Instance_finalize(GateMutex_Object *obj )
{
    Semaphore_Handle sem;

    sem = GateMutex_Instance_State_sem(obj);
    Semaphore_destruct(Semaphore_struct(sem));
}
Exemplo n.º 3
0
/*
 *  ======== SemProcessSupport_Instance_finalize ========
 */
Void SemProcessSupport_Instance_finalize(SemProcessSupport_Handle sem)
{
    Semaphore_Handle bios6sem;
 
    bios6sem = SemProcessSupport_Instance_State_sem(sem);

    Semaphore_destruct(
            Semaphore_struct(bios6sem));
}
Exemplo n.º 4
0
/*
 *  ======== GateMutex_Instance_init ========
 */
Void  GateMutex_Instance_init(GateMutex_Object *obj,
                               const GateMutex_Params *params)
{
    Semaphore_Handle sem;

    sem = GateMutex_Instance_State_sem(obj);
    Semaphore_construct(Semaphore_struct(sem), 1, NULL);
    obj->owner = NULL;
}
Exemplo n.º 5
0
/*
 *  ======== Lck_Instance_init ========
 */
Void Lck_Instance_init(Lck_Object *obj, const Lck_Params *params)
{
    Semaphore_Handle sem;

    sem = Lck_Instance_State_sem(obj);
    Semaphore_construct(Semaphore_struct(sem), 1, NULL);
    obj->value = 0;
    obj->owner = NULL;
}
Exemplo n.º 6
0
/*
 *  ======== ThreadSupport_Instance_init ========
 */
Int ThreadSupport_Instance_init(ThreadSupport_Handle obj, 
    ThreadSupport_RunFxn fxn, const ThreadSupport_Params* params, 
    Error_Block* eb)
{
    Task_Params tpars;
    Semaphore_Handle bios6sem;
 
    bios6sem = ThreadSupport_Instance_State_join_sem(obj);

    Task_Params_init(&tpars);
    tpars.arg0 = (UArg)obj;
    if (params->stackSize != 0) {
        tpars.stackSize = params->stackSize;
    }
    tpars.env = obj;

    tpars.instance->name = params->instance->name;

    if (params->osPriority != ThreadSupport_INVALID_OS_PRIORITY) {
        tpars.priority = params->osPriority;
    }
    else {
        if (params->priority == ThreadSupport_Priority_LOWEST) {
            tpars.priority = ThreadSupport_lowestPriority;
        }
        else if (params->priority == ThreadSupport_Priority_BELOW_NORMAL) {
            tpars.priority = ThreadSupport_belowNormalPriority;
        }
        else if (params->priority == ThreadSupport_Priority_NORMAL) {
            tpars.priority = ThreadSupport_normalPriority;
        }
        else if (params->priority == ThreadSupport_Priority_ABOVE_NORMAL) {
            tpars.priority = ThreadSupport_aboveNormalPriority;
        }
        else if (params->priority == ThreadSupport_Priority_HIGHEST) {
            tpars.priority = ThreadSupport_highestPriority;
        }
        else {
            Error_raise(eb, ThreadSupport_E_priority, params->priority, 0);
            return (ThreadSupport_PRI_FAILURE);
        }
    }

    obj->tls = params->tls;
    obj->startFxn = fxn;
    obj->startFxnArg = params->arg;

    Semaphore_construct(Semaphore_struct(bios6sem), 0, NULL);

    obj->task = Task_create(&ThreadSupport_runStub, &tpars, eb);
    if (Error_check(eb)) {
        return (ThreadSupport_TASK_FAILURE);
    }

    return (0);
}
Exemplo n.º 7
0
/*
 *  ======== SemProcessSupport_Instance_init ========
 */
Void SemProcessSupport_Instance_init(SemProcessSupport_Handle sem, 
    Int count, Int key, const SemProcessSupport_Params* params)
{
    Semaphore_Handle bios6sem;
    Semaphore_Params semParams;
    
    Semaphore_Params_init(&semParams);
    semParams.mode = (Semaphore_Mode)params->mode;

    bios6sem = SemProcessSupport_Instance_State_sem(sem);

    Semaphore_construct(
            Semaphore_struct(bios6sem), count, &semParams);
}
Exemplo n.º 8
0
/*
 *  ======== SemProcessSupport_Instance_init ========
 */
Void SemProcessSupport_Instance_init(SemProcessSupport_Handle sem, 
    Int count, Int key, const SemProcessSupport_Params* params)
{
    Semaphore_Handle bios6sem;
    Semaphore_Params semParams;
    
    Semaphore_Params_init(&semParams);
    if (params->mode == ISemaphore_Mode_COUNTING) {
        semParams.mode = Semaphore_Mode_COUNTING;
    }
    else {
        semParams.mode = Semaphore_Mode_BINARY;
    }

    bios6sem = SemProcessSupport_Instance_State_sem(sem);

    Semaphore_construct(
            Semaphore_struct(bios6sem), count, &semParams);
}
Exemplo n.º 9
0
/*
 *  ======== ThreadSupport_Instance_finalize ========
 */
Void ThreadSupport_Instance_finalize(ThreadSupport_Handle obj, Int status)
{
    ti_sysbios_knl_Semaphore_Handle bios6sem;
 
    bios6sem = ThreadSupport_Instance_State_join_sem(obj);

    /* status is equal to the return code from Instance_init */
    switch (status) {
        case 0:
            Task_delete(&(obj->task));

            /* OK to fall through */

        case ThreadSupport_TASK_FAILURE:
            Semaphore_destruct(Semaphore_struct(bios6sem));

            /* OK to fall through */

        case ThreadSupport_PRI_FAILURE:
        default:
            break;
    }
}