2013-08-23 3 views
0

왜이 루비 프로그램을 실행할 때 항상 종료됩니까? 내가 그것을 실행할 때, 나는이있어sinatra와 함께 eventmachine을 사용하십시오. 왜 항상 종료할까요?

require 'rubygems' 
require 'eventmachine' 
require 'thread' 
require 'sinatra' 

Thread.new do 
    EventMachine.run do 
     EM.add_periodic_timer(1) do 
      #do some things 
     end 
    end 
end 

get '/' do 
    'hello' 
end 

:
이 루비 프로그램입니다

[email protected]:~/Test$ ruby em1.rb 
== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from Thin 
>> Thin web server (v1.5.1 codename Straight Razor) 
>> Maximum connections set to 1024 
>> Listening on localhost:4567, CTRL+C to stop 
[email protected]:~/Test$ 
[email protected]:~/Test$ netstat -ant 
Active Internet connections (servers and established) 
Proto Recv-Q Send-Q Local Address   Foreign Address   State  
tcp  0  0 127.0.0.1:3306   0.0.0.0:*    LISTEN  
tcp  0  0 127.0.1.1:53   0.0.0.0:*    LISTEN  
tcp  0  0 0.0.0.0:22    0.0.0.0:*    LISTEN  
tcp  0  0 127.0.0.1:631   0.0.0.0:*    LISTEN  
tcp  28  0 192.168.241.134:38223 91.189.92.11:443  CLOSE_WAIT 
tcp  1  0 192.168.241.134:42978 91.189.94.25:80   CLOSE_WAIT 
tcp6  0  0 :::22     :::*     LISTEN  
tcp6  0  0 ::1:631     :::*     LISTEN  
[email protected]:~/Test$ 

내가이 루비 프로그램을 실행할 때이 종료 된 이유는 무엇입니까? 여기에 내가 정기적으로 http 요청과 함께 몇 가지 일을 스레드 싶어요! 내가 어떻게 해 ?

답변

0

thin 서버에서 Sinatra 앱을 실행하면 이벤트 머신

으로 해고됩니다.