From: Roger Pack Date: 2007-10-09T03:17:51+09:00 Subject: Re: Thread safety techniques for server applications? Roger Pack wrote: >> I'm looking for some information about handling thread safety with Ruby. > > Note also that sometimes if you are reading from TCPSockets the sockets > get confused and start reading from one another. To avoid this (I > think) use Francis Cianfrocca's EventMachine. > Possible ways to fix this might (might) be to ensure that every socket read/write is 'not at the same time as any other read/write' (i.e. surrounded by a mutex lock), or to perhaps write a drop in replacement for the TCPSocket class that just uses EventMachine in the background for I/O and queues the input/output. I still haven't ever found a fix for the problem of defining methods in one thread and the methods are assigned to a different thread. I think I may just report this one to ruby and forget about it. Good luck all. -Roger -- Posted via http://www.ruby-forum.com/.