Skip to content

Commit

Permalink
Run EM.run tail blocks before releasing the reactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Jul 13, 2009
1 parent 5efae6d commit d6599d8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/eventmachine.rb
Expand Up @@ -241,6 +241,10 @@ def self.run blk=nil, tail=nil, &block
@reactor_thread = Thread.current
run_machine
ensure
until @tails.empty?
@tails.pop.call
end

begin
release_machine
ensure
Expand All @@ -253,18 +257,15 @@ def self.run blk=nil, tail=nil, &block
end
@threadqueue = nil
@resultqueue = nil
@threadpool = nil
end
@threadpool = nil

@next_tick_queue = nil
end
@reactor_running = false
@reactor_thread = nil
end

until @tails.empty?
@tails.pop.call
end

raise @wrapped_exception if @wrapped_exception
end
end
Expand Down

0 comments on commit d6599d8

Please sign in to comment.