Skip to content
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

Support concurrent reading and writing via Uart #131

Open
SillyFreak opened this issue Oct 28, 2023 · 0 comments
Open

Support concurrent reading and writing via Uart #131

SillyFreak opened this issue Oct 28, 2023 · 0 comments

Comments

@SillyFreak
Copy link

Right now, the Uart struct has two methods

pub fn read(&mut self, buffer: &mut [u8]) -> Result<usize>
pub fn write(&mut self, buffer: &[u8]) -> Result<usize>

for receiving and sending data. As both of these methods require mutable access to the whole struct, reading and writing can't happen concurrently, although I think that should be conceptually possible. I've seen a few approaches that enable this:

Personally I think the third option makes for the best API, because it prevents one from having multiple concurrent readers or writers respectively, but any way to enable this would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant