Hi,

I'm having now my first contact with the pipe framework, an have some
comments about it that might be of interest to the core developers:

While the documentation is overall *great*, I fould it a bit lacking
regarding the pipes. Would be good to have some examples of general usage.

As far as I can tell, there is no mention of the usage of P_MSGPTR and
P_MSGSIZE. I had to learn about them in the headers.

At first sight, the rt_pipe_send call is confusing: why should I pass
the data size since it is supposed to be embedded in the RT_PIPE_MSG
structure?.

This is what I first did:

RT_PIPE_MSG *m = rt_pipe_alloc(sizeof(mystruct));
P_MSGPTR(m) = &mystruct;
P_MSGSIZE(m) = sizeof(mystruct)
rt_pipe_send(&mypipe, m, sizeof(mystruct), P_NORMAL);

Which is obviously wrong. Please correct me if I'm wrong:

P_MSGPTR and P_MSGSIZE are intended not to be used as an lvalue (is
there a way to define these macros to generate a compile error if they
are?).

So, the correct way would be something like this (again, correct me if
I'm wrong)::

RT_PIPE_MSG *m = rt_pipe_alloc(sizeof(mystruct_t));
mystruct_t *p = (mystruct_t *)P_MSGPTR(m);
p->whatever1 = X;
p->whatever2 = X;
rt_pipe_send(&mypipe, m, sizeof(mystruct_t), P_NORMAL);

If this is correct, why do I have to specify the size of mystruct_t
*twice*. Can't it be initialized by rt_pipe_alloc ?.

Nacho.










_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to