------art_33612_33425235.1160220674764
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 10/6/06, Serge Kruppa <serge.kruppa / simitel.com> wrote:
>
>  EW> There is one serious issue left. The Event Machine udp server that is
> used to replace the callbacks from the C native code to the ruby code dies
> after processing just one message. Apparently this has to do with the
> necessity of it running in the main thread. The main thread in the windows
> program is however used by the windows gui event loop. Probably the best
> approach is to use a simple udp server, just like in the java version.



Serge, thanks for sending me your code snippets. In regard to the problem
you're having with EM only processing one UDP message on Windows if you run
it in a thread: this is caused by the $stdin.getc call you were using to
keep your main loop alive, and has nothing to do with EM. This problem has
come up on this list before but I'm not aware that anyone has resolved it.
Does anyone on the list know?

This code does what you expect on Unix but not on Windows (tested with 1.8.4,
Christmas 2005 build from the 1-click installer):

#---------------------------------------------------------
Thread.new {
  loop {
    sleep 1
    p Time.now
  }
}

$stdin.getc
#--------------------------------------------------------

------art_33612_33425235.1160220674764--