Keep in mind that a task can post itself in the task queue prior to exiting, so, I think that you could try something like this:
uint8_t g;
uint8_t global_x;
uint8_t global_i;
uint8_t global_i;
task void taskT()
{ //you first do something on the global variable "g"...
//and then:
global_i++;
if (global_i<global_x)
post taskT();
}
//and then:
global_i++;
if (global_i<global_x)
post taskT();
}
void fucntion(uint8_t * x)
{
//in this approach, this function is used only to set the global
variables global_i and global_x and start the taskT for the first timeglobal_x= *x;
global_i= 0;
if (global_i<global_x)
post taskT();
}
What wil happen now, is that the function will start the process by calling the task for the first time, and then the task will post itself for another x-1 times.
Every time that the task will run, it will run uninterrupted (by other tasks), but in between two executions of the task the system could run something else (other tasks that have been posted by other modules or events).
I think this shoud do.
Mate.
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
