-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
error.WouldBlock thrown #30
Comments
Hey, I was looking at this code, I found that changing the io mode to blocking eliminates the error and might be ok for the sake of the example, with emphasis on the blocking behavior. From Zigs docs: |
This would completly defy the concept of the async example though. @marijnfs on which platform does this error happen? which zig version did you use? @alexnask you did the original async stuff, can you take a look at this? |
The same phenomenon brought me here. I am on Arch Linux, Zig version: 0.8.0-dev.2065+bc06e1982. |
I added this to the accept method, keeping the original async example, this worked. However, I am not so sure if this fits well. I would happily open a PR and add modifications if need be. Neat lib anyway. 👍 |
That sounds like the right thing to do. PR it in, if you have tested it and it works :) |
This does indeed avoid the block error! However the frame is never resumed, so the message is not printed when you send something. I made another pull request to the async.zig example for the previous code (with the WouldBlock error) where I added a manual suspend/resume setup. I think the async example would somehow need to be updated like this. |
I added the same step that nandor uses to recvfrom and then the async example works. |
It seems that the fix this issue was overwritten/reverted by a force push at some point, this is the current master: Reapplying Nandors solution fixes the problem. Edit: My bad, it was never merged. |
When running the async example, an error.WouldBlock is thrown by the accept() function.
It seems that this either means some issue with the event loop, or that accept also has a suspend in it?
I tried putting the accept() in the Client.handle() function and then it works, but with the current code this means a continuous stream of clients is created since it doesn't block.
How would one keep the accept blocking, but still make the rest of the code async?
The text was updated successfully, but these errors were encountered: