merge revision(s) 32549,32557: [Backport #6661]

* win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
  from rb_w32_has_cancel_io().  now it takes a parameter as fd to check
  the fd is console or not, because we cannot cancel console input even
  if we have cancel_io function.

	* io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
  so now we can kill the thread which calls STDIN.gets.
  the problem was reported by ko1 vir IRC.

	* win32/win32.c (is_socket, is_console): add prototypes to fix compile
	  problem with gcc introduced at r32549.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-06-28 08:58:21 +00:00
parent f52f03394d
commit 1d15cf4beb
5 changed files with 19 additions and 11 deletions

View file

@ -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)
{