Giter Club home page Giter Club logo

Comments (3)

ivmarkov avatar ivmarkov commented on August 16, 2024

(UPDATED)

  • Split out the RawMutex traits into a separate crate (embassy-sync-mutex, or something?), to allow for both embassy-sync and maitake-sync to rely on this

Splitting out RawMutex into its own micro-crate (ala embassy-time-driver and embassy-net-driver) - that is - if you decide against forking a subset of maintake-sync into embassy-sync - might have use-cases beyond your idea of re-using it in maintake-sync so that embassy-sync can depend on maintake-sync rather than fork it.

For example, that would give "easier time" to RawMutex implementor code that lives outside the embassy-sync crate. esp-idf-hal is currently such one, by providing two separate mutex implementations - one - based on "disable all interrupts (+ spinlocks for multi-core)" and another - based on regular FreeRTOS mutexes.

The thing is, the "one size fits all" approach of critical-section just does not work for traditional RTOSes, where you might need different types of blocking mutexes, depending on the context where you would like to use those. Abstracting by using RawMutex instead (and sure - by introducing generics that way) is one way to solve that in driver crates.

Currently, esp-idf-hal depends directly on embassy-sync, which is a bit painful. For example, our next release would be a breaking one, because embassy-sync currently went from 0.5 to 0.6. That's definitely not the only reason but could've been the only reason to issue a breaking release, which is not ideal.

from embassy.

jamesmunns avatar jamesmunns commented on August 16, 2024

Splitting out RawMutex into its own micro-crate (ala embassy-time-driver and embassy-net-driver) - that is - if you decide against forking a subset of maintake-sync into embassy-sync - might have use-cases beyond your idea of re-using it in maintake-sync so that embassy-sync can depend on maintake-sync rather than fork it.

Just confirming that I agree 100%! I didn't spell this out, but I definitely think this is a positive.

from embassy.

hawkw avatar hawkw commented on August 16, 2024

Regarding abstracting over raw mutex types, I would encourage investigating whether the lock_api crate can be used for that purpose --- it's pretty widespread in the non-embedded world, as parking-lot uses lock-api, but it also claims to have no-std support. I would look into whether its traits are suitable for our purpose. If they are, it's probably better to use the commonly-used trait rather than inventing a new version of it.

from embassy.

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.