-
Notifications
You must be signed in to change notification settings - Fork 174
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
AsyncCanDriver is not Sync #413
Comments
Why do you need it to be sync in the first place? |
I mean, a lot of the methods currently take |
@ivmarkov I was doing some testing with |
Look at the reply I gave you for the issue where one of the SPI drivers is not
So you understand, in this situation, the safer bet is always to expose something as not thread-safe, rather than as thread-safe when it turns out later it is not (and you have to make backwards-incompatible changes; going the other way, from non-thread safe to thread safe is backwards compatible). When I was mentioning that folks often stumble on the need to have something With that said... if you or other folks feel |
Thanks for the reply, yes you are right if we don't have confidence that a driver is thread-safe we shouldn't expose it as such. What bothered me is the fact that some drivers are |
These drivers were contributions by other folks, and marking these as
ESP IDF generally advertises itself as "most APIs are thread-safe unless stated otherwise". How much that statement can be trusted without carefully examining the C source code... I think we agree we should be careful here. Yet I think I'm warming up to the idea of - over time - exposing as thread safe APIs these which we have checked in C to be really thread safe.
Well it is to some extent also a library decision. As it is the library which decides whether to expose
Don't be offended by the "low quality PRs", as I didn't meant to offend you, nor anybody else! It is just the reality a bit is that we have these, and to get these through, there is a need to do a lot of hand holding (and persistence on the contributor side!). I think the actual problem is, there are very few active contributors willing to dedicate a sizeable amount of their time to learn it all on these crates. :) |
Yes I agree with you. I was referring to all those drivers that are thread safe, if we don't need to introduce some primitive for synchronization I don't think we should omit the Sync implementation. If, on the other hand, they are not thread-safe I think the opposite is true.
Yes most of the time I don't think send futures are necessary but on some occasions they might be useful. With two cores, as you said, you can use two local executors but it is not always easy to figure out how best to distribute tasks between the two. Maybe it may even be impossible if the amount of work of each task varies a lot over time. But all this maybe is a bit off-topic for this issue :) |
AsyncCanDriver is not Sync because TaskHandle_t is not Sync. AsyncUartDriver has also a field with type TaskHandle_t but Sync is implemented for it.
The text was updated successfully, but these errors were encountered: