Hello eveyone,

I'm quite a beginner with vxworks and I'd like to ask a basic
question.
I have to implement a set of three period tasks using POSIX timers. I
was wondering which is the best way to do it.
My actual implementation uses 3 tasks with different priorieties. Each
task has its own entry function and its own timer. There are also 3
counting semaphores.
Let me just write some code for explaining in a better way:

I spawn task using taskSpawn and I associate to each task a function
entryFunction.

void entryFunction(SEM_ID sem) {
..............
while(1) {
semTake(sem);
/* periodic stuff*/
}
return;
}


Semaphores are initializated to a 0 count and in the way I wrote the
code the first action on a semaphore is always the semTake.
The semaphore is given inside timer handler function every tiem it
expires. So this means the task does its periodic computation every X
ticks.

void handler(SEM_ID sem) {
semGive(sem);
return;
}

A given semaphore is taken always by the same task and given always by
the same timer.
Everything seems to work fine with this implementation. Do you think
it is a good approach (safe, efficient, etc....)? What I'm not sure
about is the use of semaphores for simulating task's idle time.

Thank you in advance,
Paolo