diff options
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c index 79f8de6e02..253a462f23 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -578,12 +578,6 @@ init_env(void) typedef BOOL (WINAPI *cancel_io_t)(HANDLE); static cancel_io_t cancel_io = NULL; -int -rb_w32_has_cancel_io(void) -{ - return cancel_io != NULL; -} - static void init_func(void) { @@ -2088,6 +2082,15 @@ set_pioinfo_extra(void) #define FDEV 0x40 /* file handle refers to device */ #define FTEXT 0x80 /* file handle is in text mode */ +static int is_socket(SOCKET); +static int is_console(SOCKET); + +int +rb_w32_io_cancelable_p(int fd) +{ + return cancel_io != NULL && (is_socket(TO_SOCKET(fd)) || !is_console(TO_SOCKET(fd))); +} + static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags) { |