Page 1 of 1

pass parameters from one task to other

PostPosted: Thu Feb 08, 2007 8:14 am
by jmles
I need to pass tree parameters from one task to other. What salvo tool could I use for it? I tried with Message Queue but to extract them it enters tree times (one for each parameter) to the waiting task. One of this parameter is an struct, the second parameter is an integer and the last is a char. What could I do?

Re: pass parameters from one task to other

PostPosted: Thu Feb 08, 2007 9:26 am
by aek
Pass a pointer to the struct, via a message or a message queue. Then deference the pointer to the element of the struct.

The main issue you may encounter is that while the pointer is persistent, the struct is not. I.e. if you signal the msg at time A and the struct changes at time B and you successfully wait the msg at time C, then the message contents (i.e. the struct that the msg pointer points to) at time C will not be the same as what they were at time A. In more complex OSes, the act of signaling would malloc a buffer and put the struct in it, but Salvo is leaner than that. So keep that in mind.

------------------