[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Blocking IO on windows in IRB

Charles L.

7/16/2007 12:30:00 AM

Is there anyway around the blocking IO on windows? I'm trying to write
an ruby app that is designed to be used from irb. It uses background
threads to do some work, but they don't appear to block at input on
windows.

Eg, running:

Thread.new { sleep 2; p 'hi' }

on windows, from irb, will never print 'hi', unless you press some keys.
Meanwhile on linux it will print just fine after 2 seconds.

--
Posted via http://www.ruby-....

1 Answer

ara.t.howard

7/16/2007 5:42:00 AM

0


On Jul 15, 2007, at 6:29 PM, Charles Lowe wrote:

> Is there anyway around the blocking IO on windows? I'm trying to write
> an ruby app that is designed to be used from irb. It uses background
> threads to do some work, but they don't appear to block at input on
> windows.

basically, if you have to do background io use another process. my
systemu lib is a cross platform way of dealing with stdin/out/err etc
for background processes - you might want to check it out for ideas

http://codeforpeople.com/lib/ruby/systemu/systemu-1....

gem install systemu

this plus code generation can skin some cats. good luck.

a @ http://draw...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama