[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: exerb and a threaded server

Albert Chou

9/23/2003 8:57:00 PM

Dan,

You can also use the following trick to allow Windows to see the Ctrl-C
signal. Put the line

Thread.new { loop { sleep 0.01 } } # workaround to allow Ruby on Windows
to handle Ctrl-C to quit

before the main loop of your program.


Al


-----Original Message-----
From: Berger, Daniel [mailto:djberge@qwest.com]
Sent: Tuesday, September 23, 2003 1:43 PM
To: ruby-talk ML
Subject: Re: exerb and a threaded server

> -----Original Message-----
> From: Nathaniel Talbott [mailto:nathaniel@NOSPAMtalbott.ws]
> Sent: Tuesday, September 23, 2003 2:29 PM
> To: ruby-talk@ruby-lang.org
> Subject: Re: exerb and a threaded server
>
> Berger, Daniel [mailto:djberge@qwest.com] wrote:
>
> > However, when I tried to build and rbc file, it just hangs:
> > C:\test>ruby -r exerb/mkrbc exetest.rb -> hangs indefinitely
> >
> > Any ideas?
>
> Well, mkrbc basically just sits back and watches your program
> run from start to finish, recording all the required
> libraries along the way. In this, case your program sits
> there waiting for connections, thus mkrbc sits there waiting
> for your program. You need to do something to quit the
> program, and then mkrbc should write out your recipe file.
>
> HTH,
>
>
> Nathaniel
>
> <:((><

Ah, ok. Because of the curious interaction SIGINT and threads on
windows, the first thing I tried was killing this using the Task
Manager. However, when I did that the .rbc file was NOT generated.

I got it to work by running "ruby -r exerb/mkrbc exetest.rb" and hitting
Ctrl-C in one terminal (which doesn't kill it), and then attempting to
make a connection in a second terminal with a throw-away client script
(which then does kill it). At that point, the .rbc file was generated,
I created a .exe and ran it successfully.

Anyway, hope that helps future Googler's. And thanks Nathaniel.

Regards,

Dan