On Sunday 16 January 2005 16:03, ts wrote:
> >>>>> "B" == Bjarke Bruun <bbj / swooplinux.org> writes:
>
> B> 			fork {
>
>  Why you don't use a thread, with a block local variable for @s

This is just a "test" for me. It's not (yet anyway) in progress of 
beeing published... the rfc is large for startes, but the fork, IMHO, 
has less footprint than threads and threads in ruby are only threads 
inside the ruby process so the difference is the same until Matz et. 
al. implements native threads for ruby (which I'm waiting for :-))

The problem is not the local socket that is talking to the client it's 
the main socket that hangs if I don't use "kill -9" and I would like to 
find a way to fix that... "E S" has a point, but I'm new to Ruby and 
don't quite know where to get info on usage of the 
Signal#trap and Process#abort  right now. Always glad to learn more but 
from scratch is hard, if you remember :-)

I'm looking for something like this

$ ./rsmtp.rb # the name of the server script

and then be able to press <ctrl-c> without having the socket hanging for 
some 30 seconds before I can start the script again. I had a similar 
experience in school a long time ago in C++ but I can't remember the 
code I wrote back then to overcome this problem... and I don't have the 
code anymore FYI.

I'm looking in "Programming Ruby: The Progmatic Programmer's Guide" with 
no luck as to set up a trap for the script if it receives (SIG)KILL 
signal - where to look?

-- 
Bjarke Bruun
(Verify PGP-signature at hkp://pgp.mit.edu)
Vegetarians eat Vegetables, Humanitarians frighten me.