Allow synchronous win32 I/O to be interrupted, too
authorDavid Lichteblau <david@lichteblau.com>
Fri, 5 Oct 2012 20:10:53 +0000 (22:10 +0200)
committerDavid Lichteblau <david@lichteblau.com>
Fri, 2 Nov 2012 12:23:19 +0000 (13:23 +0100)
commit3f85a9ec737176a4543f64f8f0cc08500ce23106
tree0f3f6f2f8157eb41a33faf3a23df0a392eab60cd
parent0baeb07f52b4682556263722cae48df0e9200239
Allow synchronous win32 I/O to be interrupted, too

... if and only if running on a version of Windows new enough to
support doing so.  Two scenarios come to mind where synchronous (i.e.
non-overlapped) I/O might matter:

  - There is one kind of HANDLE which is never overlapped: Unnamed
    pipes.  Unlike named pipes, the feature added by this commit is
    our only option of interrupting I/O on the former.

  - User code might pass in a HANDLE through MAKE-FD-STREAM without
    the right flag set.  In principle, non-interruptibily of such a
    HANDLE is a bug in said user code, but it doesn't hurt to deal
    with these correctly as a side benefit.  (The only Windows
    releases which support re-opening of a HANDLE with the right
    flag also have the functions needed by this commit.)

One downside for users might be an element of surprise, in that the
same SBCL binary will exhibit the presence or lack of features,
respectively, when started on recent Windows or old Windows.  However,
the advantages of offering the feature seem to me to outweigh that
disadvantage.

Thanks to Anton Kovalenko.
src/compiler/generic/objdef.lisp
src/runtime/print.c
src/runtime/safepoint.c
src/runtime/thread.c
src/runtime/win32-os.c
src/runtime/win32-os.h
tests/threads.impure.lisp