Pumpkin, Inc.

Pumpkin User Forums

Best method to start a task

If you can't make Salvo do what you want it to do, post it here.

Best method to start a task

Postby peden » Sun Feb 06, 2011 8:14 am

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
peden
 
Posts: 7
Joined: Fri Jan 30, 2009 12:00 am
Location: Denmark

Re: Best method to start a task

Postby aek » Mon Feb 07, 2011 1:41 pm

Both methods work ... I tend to use OSStart|StopTask() ...
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron