Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

interconnect is (probably) unsound and unclear #2954

Open
bugadani opened this issue Jan 14, 2025 · 0 comments
Open

interconnect is (probably) unsound and unclear #2954

bugadani opened this issue Jan 14, 2025 · 0 comments
Labels
bug Something isn't working peripheral:gpio GPIO peripheral status:needs-attention This should be prioritized

Comments

@bugadani
Copy link
Contributor

Because InputConnection is Clone, Send and Sync, (and to a lesser extent, OutputConnection is a superset of InputConnection), the API is prone to data races, which is UB. Consider cloning an InputSignal, sending it to the second core, and using both clones to set up some peripheral.

The behaviour, when connecting multiple peripherals is also undefined (as the different peripherals may overwrite each others' settings).

We can probably leave the output-related implementation unchanged. There can only be one OutputConnection in safe code, and only a single peripheral may drive that.

For the input side, however, I think we will need to make the user set up the pin, before passing it to peripherals. This way we can ensure, that, if the user want to connect peripherals which would, by default use conflicting configuration, the user needs to specify what actually happens.

@bugadani bugadani added bug Something isn't working peripheral:gpio GPIO peripheral status:needs-attention This should be prioritized labels Jan 14, 2025
@bugadani bugadani changed the title interconnect is unsound and unclear interconnect is (probably) unsound and unclear Jan 15, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working peripheral:gpio GPIO peripheral status:needs-attention This should be prioritized
Projects
Status: Todo
Development

No branches or pull requests

1 participant