From: Yohanes Santoso Date: 2004-08-31T22:24:20+09:00 Subject: Re: Two issues with webrick - both threading & OS related rdlugosz.1044583@bloglines.com writes: > The media program aside, working with Jim Weirich today we discovered some > other interesting things. A absolutely basic webrick servlet that has a Thread.sleep > in it's do_get will block all access to the servlet on any OS - the blocked > request will execute immediately upon the blocker completing. Here's the Funny, I do not observe that behaviour: -------------------------------------------------- class SleepServer < HTTPServlet::AbstractServlet def do_GET(req,resp) resp.body="Start: #{Time.new}\n" sleep(10) resp.body << "End: #{Time.new}\n" resp['content-type'] = 'text/plain' end end class GreetServer < HTTPServlet::AbstractServlet def do_GET(req, resp) resp.body="Hi, now is: #{Time.new}\n" resp['content-type']='text/plain' end end start_webrick {|server| server.mount('/sleep', SleepServer) server.mount('/greet', GreetServer) } -------------------------------------------------- I then open 3 terminals and run: Terminal 1: dede:~$ w3m -dump http://localhost:8080/sleep Start: Tue Aug 31 06:16:35 PDT 2004 End: Tue Aug 31 06:16:45 PDT 2004 Terminal 2: dede:~$ w3m -dump http://localhost:8080/sleep Start: Tue Aug 31 06:16:37 PDT 2004 End: Tue Aug 31 06:16:47 PDT 2004 Terminal 3: ede:~$ w3m -dump http://localhost:8080/greet Hi, now is: Tue Aug 31 06:16:39 PDT 2004 dede:~$ w3m -dump http://localhost:8080/greet Hi, now is: Tue Aug 31 06:16:41 PDT 2004 dede:~$ w3m -dump http://localhost:8080/greet Hi, now is: Tue Aug 31 06:16:43 PDT 2004 dede:~$ w3m -dump http://localhost:8080/greet Hi, now is: Tue Aug 31 06:16:50 PDT 2004 dede:~$ ruby -v ruby 1.8.1 (2004-02-03) [i386-linux] Notice that while the /sleep in terminal 1 is waiting, another /sleep call on terminal 2 is issued. And while terminals 1 and 2 are waiting for the output, multiple /greet calls on terminal 3 can be executed just fine. So, I do not observe the blocking phenomenon you observed. I can't verify your next problem since I don't have access to XP. YS.