id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
7353	Make system IO interruptible on Windows	joeyadams		"Currently, IO operations (connect, read, etc.) cannot be interrupted on Windows.  Additionally, threadWaitRead and threadWaitWrite do not work on Windows (IIRC, they can't tell if the given file descriptor is a socket or not, so they assume it's not).

The reason is that GHC does not have an IO manager for Windows like it does for *nix.  For Windows with -threaded, the network package uses blocking FFI calls, which cannot be interrupted by asynchronous exceptions.  Thus, System.Timeout and killThread can't be used to time out and interrupt network IO.

I'm working on a program that needs to run on a Windows XP machine for long periods of time, interacting with a couple intermittent network services.  This issue is making things very difficult for me, so I want to get it fixed.  I do not need to support thousands of concurrent connections efficiently; I just need my program to run reliably.

What needs to happen for IO to be interruptible on Windows with -threaded ?  I'm willing to put in the work, but there's a lot I'd have to learn about windows IO and GHC IO handling.  One question to get started: are threadWaitRead/threadWaitWrite even possible to implement on Windows, or might Windows assign overlapping HANDLE numbers to sockets and regular files?

This issue spans both GHC and the network package, but I'd like to collect information about it in one place.  Related issues:

 * http://trac.haskell.org/network/ticket/2

 * https://github.com/haskell/network/issues/36

 * http://hackage.haskell.org/trac/ghc/ticket/3937

 * http://hackage.haskell.org/trac/ghc/ticket/5797"	bug	new	normal	7.8.1	libraries/base	7.6.1			idhameed@… bos@… shelarcy@… dagitj@…	Windows	Unknown/Multiple	Incorrect result at runtime	Unknown				
