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

Help with multithreading, read and write. #80

Open
yunfengwangluo opened this issue Dec 18, 2023 · 2 comments
Open

Help with multithreading, read and write. #80

yunfengwangluo opened this issue Dec 18, 2023 · 2 comments

Comments

@yunfengwangluo
Copy link

First of all, thank you for using your valuable experience to see my request!
I want to use two threads to handle reads and writes separately, but I haven't found any good methods other than using read write locks. The read write lock, due to its ability to block, has not yet achieved the goal of simultaneously reading and writing separately.
Is there any solution?

@szguoxz
Copy link

szguoxz commented Jan 21, 2024

This could be achieved by tokio::select(readfuture, writechannelrecvfuture), but the solution sucks. Ultimately, I believe the tun driver needs to address this. this is such a big problem, I am surprised it's not addressed from day one.

@szguoxz
Copy link

szguoxz commented Jan 21, 2024

I found a way to achieve this:
dev.into_framed().split()

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

2 participants