Re: net_buf: non-atomic reference counting

Paul Sokolovsky


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

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


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?


Best Regards,
Paul | Open source software for ARM SoCs
Follow Linaro:!/linaroorg -

Join to automatically receive all group messages.