Project

General

Profile

Actions

Backport #6661

closed

Timeout not working with IO on Windows

Added by undur_gongor (Undur Gongor) over 11 years ago. Updated over 11 years ago.

Status:
Closed
[ruby-core:45920]

Description

This code does not time out as expected when run on Ruby 1.9.3p194 (2012-04-20) [i386-mingw32]:

require 'timeout'
Timeout.timeout(1) { gets }

On different Unix-like OSes it does time out after 1 second with different versions of Ruby.

Updated by luislavena (Luis Lavena) over 11 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

Updated by usa (Usaku NAKAMURA) over 11 years ago

There is no problem on trunk, but I forgot which change fixed it...
Maybe r34388?

I'll test it later.
If there are those who can check ahead of me, please do it.

Actions #3

Updated by usa (Usaku NAKAMURA) over 11 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193

Updated by usa (Usaku NAKAMURA) over 11 years ago

  • Assignee changed from usa (Usaku NAKAMURA) to naruse (Yui NARUSE)

r32549 is the right answer.
naruse, could you merge it?

Updated by usa (Usaku NAKAMURA) over 11 years ago

... and, r32557 .

Actions #6

Updated by naruse (Yui NARUSE) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36244.
Undur, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


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.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0