win32: input: use Vista CancelIoEx

libwaio was added due to the complete inability to cancel synchronous
I/O cleanly using the public Windows API in Windows XP. Even calling
TerminateThread on the thread performing I/O was a bad solution, because
the TerminateThread function in XP would leak the thread's stack.

In Vista and up, however, this is no longer a problem. CancelIoEx can
cancel synchronous I/O running on other threads, allowing the thread to
exit cleanly, so replace libwaio usage with native Vista API functions.

It should be noted that this change also removes the hack added in
8a27025 for preventing a deadlock that only seemed to happen in Windows
XP. KB2009703 says that Vista and up are not affected by this, due to a
change in the implementation of GetFileType, so the hack should not be
needed anymore.
This commit is contained in:
James Ross-Gowan
2015-12-07 18:51:33 +11:00
parent 0563eb914f
commit 7558d1ed7b
6 changed files with 66 additions and 90 deletions

View File

@@ -188,25 +188,3 @@ a pthreads wrapper or you want to build mpv without one, configure with:
```bash
./waf configure --enable-win32-internal-pthreads
```
libwaio
-------
If you want to use ``--input-file``, you need libwaio. It's available from
git://midipix.org/waio
To compile libwaio in MSYS2, run:
```bash
git clone git://midipix.org/waio && cd waio
# 32-bit build, run from mingw32_shell.bat
./build-mingw-nt32 lib-static CC=gcc AR=ar
cp -r include/waio /mingw32/include
cp lib32/libwaio.a /mingw32/lib
# 64-bit build, run from mingw64_shell.bat
./build-mingw-nt64 lib-static CC=gcc AR=ar
cp -r include/waio /mingw64/include
cp lib64/libwaio.a /mingw64/lib
```