More elaborate k_fifo API?


Paul Sokolovsky
 

Hello,

Motivation: BSD Sockets API work.

I already have code like:

+ // TODO: k_fifo accessor for this?
+ struct net_buf *last_buf = (struct net_buf*)sys_slist_peek_tail(&socket->recv_q.data_q);

to peek tail element of the fifo.

And I get a next net_buf and store it in a pointer within a socket
structure, but instead I could just peek a head element - as long as
fifo would allow me to wait until it becomes non-empty (without
extracting first element, I'll peek it afterwards). Granted, this can
be done with adhoc code like peeking tail, but becomes more and more
fragile.

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

Join devel@lists.zephyrproject.org to automatically receive all group messages.