2006/4/23, Pat Maddox <pergesu / gmail.com>:
> Well this is all because I need to interact with a remote server that
> sends asyncrhonous messages.  I suppose the most common server that's
> similar is an IRC server.  You connect to the server, and then just
> wait while it pumps out messages to you.  The way I've implemented
> this in other languages is to create a new thread which simply has an
> infinite loop (checking a control condition, such as @connected) that
> reads data from a socket.  So in cases like this, the read call would
> block until some data comes through the socket.  Then it parses the
> text and the loop continues.  I'm trying to do the same thing with
> Ruby.

If your program does not have to do anything else you don't need threads at all.

If you actually want to do other stuff in parallel then it depends on
which part decices that your processing thread(s) are finished how you
do the termination code.  If you give more information on this it's
easier for us to come up with a solution.

Kind regards

robert


--
Have a look: http://www.flickr.com/photos/fussel-foto/