From: Francis Cianfrocca Date: 2006-07-05T07:47:01+09:00 Subject: Re: Multiple Threads? ------=_Part_3210_12640140.1152053218473 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Ezra: I sent Marcus the following description of an approach to his application, and will post more to this list if the approach turns out to be worth something. (snipped from a private email:) Ok, here's what I would do: I assume you have a global hash that maps the description of each "customer" with a status indicating whether or not it currently has an active client. (You can use the same data structure to store and report status results received from the connections.) Have the EventMachine fire a timer every five seconds that examines each of the customers and starts up a new client connection for every one that is inactive. Once a connection is open for each customer, your connection-handling code can start up a new connection whenever they close (which is an event passed by EM to your code). The five-second timer is only there for a heartbeat, to bootstrap the system, and in case an unexpected exception occurs. Because there are no threads, there are no race conditions. Very simple. ------=_Part_3210_12640140.1152053218473--