-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do Rust Native Queues and Mutexes Properly Suspend Tasks #277
Comments
As far as I know, all rust platform APIs use libc behind the scenes, which then uses the newlib implementation in esp-idf-sys, which for the threading stuff ultimately uses the right FreeRTOS APIs. So in short, yes. |
I also confirm that all Rust sunchronization primitives, including @N3xed is right that you should be extra careful if you also plan to hook FreeRTOS interrupts yourself, because in that case you cannot use off-the-shelf Rust synchronization primitives, as they are not interrupt-safe. In that case, you should do unsafe calls into FreeRTOS primitives, or use the few ones which already have safe Rust wrappers in As for questions, please use the Matrix channel, which is linked from the README of this crate. |
Note: Hopefully posting a question here is allowed. If not, please let me know where I should be asking this so I can put the question in the correct place.
When writing code in C/C++ with the ESP-IDF, functions that read from a queue (e.g.
xQueueReceive
) or attempt to take a mutex (e.g.xSemaphoreTake
) will put the task task into a suspended state, so that the FreeRTOS system can switch to other tasks while waiting for the resource to be obtained. Will the equivalent functionality built into Rust do this as well?I ask as I considering on porting a project from C++ to Rust that will need to read from different sensors in different tasks, and it seems that
embedded-hal-bus
is the way to do this. Furthermore, I will then have a task that needs to sit waiting to be able to read data from a queue. I would like to be able to use Rusts's built in functions to do this, but I'm worried that the tasks will not properly suspend when they are waiting.The text was updated successfully, but these errors were encountered: