MLton.Socket.shutdown{Read,Write}

Stephen Weeks MLton@sourcelight.com
Tue, 7 Aug 2001 21:26:25 -0700


> No,  you definitely cannot have close call the shutdown.  The problem is that
> you might have fork'd or dup'd and have other ways to write or read.  If  the
> last  file  descriptor is closed, then the shutdown message gets generated by
> the kernel.  The whole insanity of shutdown comes from  reading  and  writing
> being  done on the same file descriptor.  Thus the kernel can't know when you
> are done writing, so the shutdown abomination was added.  If Joy  weren't  an
> idiot,  accept would have given you a pair of file descriptors, just like the
> pipe system call, one for reading and one  for  writing.   Similarly  connect
> would give you a second file descriptor (or take 2 as an argument).  Then the
> kernel would do the `garbage collection' and know when you were done talking.

OK.  But it still sounds like shutdown should call close.