Re: net_buf: non-atomic reference counting


Paul Sokolovsky
 

Hello,

On Tue, 24 Mar 2020 11:25:48 +0200
"Jukka Rissanen" <jukka.rissanen@...> wrote:

Hi Darryl,

I think it is more of a historical relic than a purpose design. There
has not been any reports that this have caused issues. Patches are
welcome of course.
Perhaps it could be rephrased differently: net_buf is more like Zephyr's
internal system object. Where it's used currently, thread
synchronization is expected(*) to happen on different level(s), and
net_buf itself is kept lightweight and optimized. Perhaps that can be
changed, but effects on existing subsystems using net_buf should be
considered.

(*) That doesn't mean there're no bugs, so reproducible bugreports are
welcome.


Cheers,
Jukka


On Sun, 2020-03-22 at 17:39 -0700, Darryl Gamroth wrote:
Hi all,

I was looking at using net_bufs for an application broadcasting
reference counted buffers to multiple threads and I noticed the
reference counting is not atomic. I'm curious, is this by design?

Thanks.

--
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.