Handles blocking and nonblocking mode.
Handles callback mode in an arbitrary backend (also in blocking
mode).
Read and write operations might each do both reading and
writing. In callback mode that means that installing either a
read or a write callback might install both internally. It also
means that reading in one thread while writing in another
doesn't work.
Callback changing operations like set_blocking and
set_nonblocking aren't atomic.
Apart from the above, thread safety/atomicity characteristics
are retained.
Blocking characterstics are retained for all functions.
is_open , connection init (create ) and close (close ) can
do both reading and writing.
destroy attempts to close the stream properly by sending the
close packet, but since it can't do blocking I/O it's not
certain that it will succeed. The stream should therefore always
be closed with an explicit close call.
Abrupt remote close without the proper handshake gets the errno
System.EPIPE .
Objects do not contain cyclic references, so they are closed and
destructed timely when dropped.