Giter VIP home page Giter VIP logo

Comments (3)

rudib avatar rudib commented on June 4, 2024

No, queues cannot be used for heap allocated data structures, which is by FreeRTOS's design, and which is enforced using Rust's copy semantics. Try to redesign your application to pass only Copy structures. If you really need that, you might want to look into storing data into a global, shared vector (Arc<Mutex<Vec>>) and passing plain IDs using queues.

from freertos.rs.

lexxvir avatar lexxvir commented on June 4, 2024

Sorry for annoying, I believe that in FreeRTOS it possible to allocation data in heap and then send pointer to allocated memory to queue. Then receiver will be responsible to free memory. Of course allocated memory must not used by sender when he sent pointer to queue.

In Rust we can use Box for this purpose, but, as I understood now, it is require separated implementation, that will be:

  1. consume Box by into_raw
  2. send raw pointer by queue
  3. restore Box at receiver side by Box::from_raw from raw pointer

from freertos.rs.

rudib avatar rudib commented on June 4, 2024

Sure, you can do that. No changes are necessary within this Rust library, you can easily implement that as a trivial typed Rust struct that only holds a single usize pointer. But support for this won't be added to this project.

from freertos.rs.

Related Issues (17)

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.