-
Notifications
You must be signed in to change notification settings - Fork 71
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
read() does not return after a call to close() #41
Comments
I was not aware about this blocking read in a multithreaded environment. So I googled it for myself and found this: |
Thanks for the hint! I'll take a look at it. |
I got a similar report a while back on my JavaCAN lib (a thin wrapper around SocketCAN) and the reporter had the same issue with a CAN_RAW socket too. Back then I found this which made sense to me. |
In the
main()
, I'm opening a can-isotp socket, and I performwrite()
operation on it. This part is working, the expected CAN frames are sent on the bus.Now, I'm performing a blocking call to
read()
on a separated thread. This part is also working, I'm receiving the expected CAN frames.The issue arises when I'm calling
close()
on themain()
function. I would expect theread()
function to return an error (such asEBADF
or something similar), but instead of this, it keeps blocking, while theclose()
function returns 0.Is it the expected behaviour? If it is the case, what is the proper way to exit from a blocking
read()
?The text was updated successfully, but these errors were encountered: