nemo157 / embrio-rs Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
This might be a conceptual misunderstanding on my part, but I believe you can remove the AtomicBool from Waker and this would remove the static lifetime requirement, as the Waker would then have no state - it could be a nullptr and the vtable static.
The key observation is it is not illegal to call poll again on a future that has returned Pending but not invoked the waker, just ill-advised if you can do better. In this case we can't - all the AtomicBool does is move the location of the busy wait.
On armv6m and armv7m the AtomicBool is ultimately duplicating the functionality already provided by the wfe - assuming it isn't actually treated as a noop, in which case busy waiting is the best you can do anyway.
If my reasoning is wrong, I'd be very interested to know as I'm currently working on a PoC embedded_hal, see here, that somewhat relies on this logic being correct...
It would be a fairly small optimization, but would be helpful for users of the library on platforms other than arm. At worst, it's a NOP on a given platform that would be optimized to the same as it is now.
I see there are two timers implemented in https://github.com/Nemo157/embrio-rs/tree/master/embrio-nrf51/src/timer. But as far as I can see they aren't used anywhere?
How is one supposed to use them?
Not sure if this is something that's fixable or not. If something.await
is in the arguments to a macro expression, it can't be expanded since syn
represents the arguments to a macro invocation as an un-parsed TokenStream
.
For example, write!(output, "{}", something.read().await)
would result in a "await used outside of an async
block" compile error since our macro wouldn't see the something.read().await
as an expression or be able to traverse it.
I think the only way to solve this reliably would be to somehow ensure that we're the last macro to be expanded, which doesn't seem to be a thing, but there's a pre-rfc that sounds like what we'd need.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.