-
Notifications
You must be signed in to change notification settings - Fork 8
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
Unable to use the Writer from a different thread. #29
Comments
Note that I can't pass the created PipeWriter directly to the other thread (the only shared state is the file descriptor number) |
You need to either call |
Thanks. The only issue i see is into_raw_fd() does mem::forget(). Is there a way to close the fd after i read everything from the pipe? Just as a safety to avoid leaking since the methods in PipeFd are not public |
It
If you created a
If you are worried about leaking the fd when passing to a different thread, you can use |
@duggaraju In my environment, it seems to be possible to write across threads with If there are any misunderstandings, I would appreciate it if you could point them out. |
I craeate a tokio pipe. in the thread where the pipe is created, I am reading from the read end till end of file. In another thread where I pass the writeer as a raw fd, I try to create a new PipeWrite (PipeWrite::from_raw_rd_checked(fd)). However that call fails because the creation of AsyncFd() seems to be failing since the file descriptor is already registerered?
Is there a way to safely separate the writing and reading across two different threads?
The text was updated successfully, but these errors were encountered: