Giter Site home page Giter Site logo

Comments (4)

jhedberg avatar jhedberg commented on July 22, 2024 2

@jori-nordic thanks for creating this issue. Just a few quick thoughts:

  • I don't think we want to constrain this API to ref == 1. Moving a reference doesn't need to imply that this is the only reference there is - that's a separate use-case specific constraint IMO.
  • Since we have atomic_ptr_clear() I'd just use it. Most places may not need it right now, but as we move towards supporting preemptible threads then being able to use this API without locking will be nice.

from zephyr.

jukkar avatar jukkar commented on July 22, 2024

To me this new function gives impression of moving the data from/to the net_buf, like what memmove() does. Not sure what it could be called, but some examples could be net_buf_replace(), net_buf_swap() or similar.

from zephyr.

jhedberg avatar jhedberg commented on July 22, 2024

To me this new function gives impression of moving the data from/to the net_buf, like what memmove() does. Not sure what it could be called, but some examples could be net_buf_replace(), net_buf_swap() or similar.

@jukkar point taken. That said, we do tend to use net_buf_*_mem() in the net_buf API for memory operations. Also, "move" is verb that's used for analogous things in other languages, like Rust. Would it help to append _ref() to the API, i.e. net_buf_move_ref()? (not sure I prefer that more, but that could just be due to my dislike for unnecessarily long symbol names :)

from zephyr.

jukkar avatar jukkar commented on July 22, 2024

Yes, net_buf_move_ref() would indeed be better here.

from zephyr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.