Changeset 739

Show
Ignore:
Timestamp:
07/20/08 17:35:09 (4 months ago)
Author:
francis
Message:

created EM#fork_reactor, applying patch from Aman Gupta.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/eventmachine.rb

    r737 r739  
    252252            } 
    253253            run(&pr) 
     254    end 
     255 
     256    # fork_reactor forks a new process and calls EM#run inside of it, passing your block. 
     257    #-- 
     258    # This implementation is subject to change, especially if we clean up the relationship 
     259    # of EM#run to @reactor_running. 
     260    # Original patch by Aman Gupta. 
     261    # 
     262    def EventMachine::fork_reactor &block 
     263            Kernel.fork do 
     264                    if self.reactor_running? 
     265                            self.stop_event_loop 
     266                            self.release_machine 
     267                            self.instance_variable_set( '@reactor_running', false ) 
     268                    end 
     269                    self.run block 
     270            end 
    254271    end 
    255272