If you create a UnixSocket, set a read timeout and then:
- call read()on one thread
- wait a bit and then call close()on another thread
...the behaviour is different on OS X and Linux.
On OS X, the read is cancelled as soon as close() is called and so close() returns immediately. On Linux, the read blocks until the read timeout is reached, and then close() returns.
This makes interrupting read operations impossible, and is the root cause of square/okhttp#4233.
I have created a test case that fails on Linux (but passes on OS X) in charleskorn@b0981ae.