Port.Flush() sets file descriptor to blocking mode in linux
elliotmr opened this issue · comments
the call to p.f.Fd()
inside the Port.Flush()
sets the file descriptor to blocking mode. Either we should save a reference to the file descriptor in the object field or set the fd back to non-blocking mode after flush is complete.
Holy smokes, I just saw that it is specifically setting the file descriptor to be blocking instead of blocking. Is there a specific reason for this?
Just for a little more context, since Go 1.11, if you open an os.File in non-blocking mode, it will add it to the runtime poller and you won't have to sit with a blocked os thread when you call read. This has the added benefit of allowing a concurrent close to the port and it then kicking you out of an active read.