-
Notifications
You must be signed in to change notification settings - Fork 51
Concurrency support: detect closed file descriptors #8
Comments
@bartmeuris Did you resolve this problem? I've been stuck on this problem for days. |
Hey there, as far as I understand, go's os.File Close() interrupts Read().
Yes, there is just plain os.Open() called on the specified device @Sky-Li could you elaborate on what the problem you are facing exactly? (maybe some test case?) |
Hi @kovetskiy , I tried many functions to interrupts Cause the code relies on the input device, so I don't know how to provide the test case on go playground. Here is the example,
|
I see, it doesn't work for me either. I also tried Also, from the man 2 close:
But if you really want to get rid of hanging read, I could only recommend you trying to patch the package a bit and use epoll (syscall.EpollCtl) instead of device.File.Read as the package does. |
I haven't tried epoll before, I will consider and try to play with it. |
In order to cancel an ongoing read, I assumed is was sufficient to close the underlying file-descriptor by calling
dev.File.Close()
- but theReadOne
function (and I suppose the normalRead
also) hangs until a new message arrives on the input device (tested with evemu).I don't really see any other way to abort a read in progress... I've looked briefly into the code but couldn't immediately see what would be wrong, it just seems to use normal Go i/o internally?
Tested with
go version go1.11.2 linux/amd64
with evemu.The text was updated successfully, but these errors were encountered: