Thread enhancements - #592
Conversation
b67b85e to
6c0cf03
Compare
6c0cf03 to
add36d0
Compare
|
@Vollbrecht If you don't feel like reviewing this I can merge right away. It is anyway a bit specialized stuff. |
|
I already was looking into it, but currently am traveling. I think overall i think it looks like a solid refactor, though as i hinted i am currently not in the country so my time is limeted. One thing i am curious about, could you just briefly explain the gains of using the UnsafeCell<Box>. Before you needed two indirection, but this is all still a opauque pointer that you smuggle into the C callback context. Does the UnsafeCell allow you for cheaper init when you got it from the C side or what place purpose does it have. |
|
But overall if it works i think it looks fine by me ;D |
|
So for the SRP state change we need something like a MultiWakerRegistration from embassy-sync to navigate around the problem you have with multiple async task? Is this a performance critical path or can we use some of the shelf async multi task solution for it? |
Before:
Now:
As for the |
c44a7ca to
fc69f03
Compare
No we don't need any of this. Just like Wifi, so is Thread publishing events for its various state changes on the system event bus. So if the user would like to be notified on such changes, she can subscribe to the system event bus and listen to these events. They are even mapped to Rust typesafe enums since the previous version already. Or the user can just use polling as I do, which for most cases is good enough. The commented out code was a carry-over from the bare-metal |
Thread Enhancements
This work is the outcome of the ongoing effort to enable
esp-idf-matterto operate over the Thread protocol as well.Submission Checklist 📝
cargo fmtcommand to ensure that all changed code is formatted correctly.cargo clippycommand to ensure that all changed code passes latest Clippy nightly lints.CHANGELOG.mdin the proper section.Pull Request Details 📖
This PR is extending the existing Thread impl as follows:
start/stopthe Thread stack (the existingThreadDriver::runmethod is removed). Note that stopping the Thread stack requires ESP IDF V5.5, or the not-yet released patch-levels V5.3.4, V5.4.3 and so on up to V5.1.X. Before this change into ESP-IDF itself, it was simply not possible to stop the Thread event loop in a clean manner, which was quite annoyingThreadDriver::init / ThreadDriver::deinitare gone. The initialization is done simply on thread driver (orEspThread) construction, and the deinitialization - when the driver is dropped.With the addition of the
start/stopmethods, and with the removal of theinit/deinitmethods, the API ofThreadDriver/EspThreadbecomes quite similar toWifiDriver/EspWifiwhich I think is a big advantage, as switching one for the other is much more seamless.Testing
Testing was done with
esp-idf-matteritself.