Page 1 of 1

Best method to start a task

PostPosted: Sun Feb 06, 2011 8:14 am
by peden
Hi

I was wondering which of the following two methods might be best and/or least resource demanding for activating one task from within another task, and if there's some advantages/disadvantages of using one method over the other.
1. Activating the task by signaling a semaphore with OSSignalBinSem()?
2. Or is it just as okay to start it by calling OSStartTask() each time the task needs to run? (where the task has been declared as OSDONT_START_TASK in salvocfg.h so it doesn't start automatically)

Code: Select all
// Task that is activated with a OSStartTask(Task1)
void Task1(void)
{
    while (1)
    {
        .......
   
        OS_Stop();
    }   
}

// Task that is activated with a OSSignalBinSem(Sem_Task1)
void Task1(void)
{
    while (1)
    {
        OS_WaitBinSem(Sem_Task1);      
        .......
    }   
}


(I'm using Salvo Pro 4.2 for AVR with the IAR EWAVR 5 compiler)

//peden

Re: Best method to start a task

PostPosted: Mon Feb 07, 2011 1:41 pm
by aek
Both methods work ... I tend to use OSStart|StopTask() ...