From e7e4f90a1c1288aa3ea6566b61566f05d2896031 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Fri, 30 Mar 2007 19:40:26 +0000 Subject: [PATCH] fix synchronization issue with Gateway initialization git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@6496 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- CHANGELOG | 2 ++ lib/capistrano/gateway.rb | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 05cb2d18..12e56a13 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fix synchronization issue with Gateway initialization [Doug Barth] + * Added opt-in "compat" and "upgrade" recipes for tasks to aid in the upgrade process to Capistrano 2 [Jamis Buck] * The deployment recipes are now opt-in. Just do 'load "deploy"' in your recipe script. [Jamis Buck] diff --git a/lib/capistrano/gateway.rb b/lib/capistrano/gateway.rb index 180fd3a7..1e5ca3a5 100644 --- a/lib/capistrano/gateway.rb +++ b/lib/capistrano/gateway.rb @@ -38,18 +38,18 @@ module Capistrano mutex = Mutex.new waiter = ConditionVariable.new - @thread = Thread.new do - logger.trace "starting connection to gateway `#{server.host}'" if logger - SSH.connect(server, @options) do |@session| - logger.trace "gateway connection established" if logger - Thread.pass - mutex.synchronize { waiter.signal } - @session.loop { !@terminate_thread } - end - end - mutex.synchronize do - Thread.pass + @thread = Thread.new do + logger.trace "starting connection to gateway `#{server.host}'" if logger + SSH.connect(server, @options) do |@session| + logger.trace "gateway connection established" if logger + mutex.synchronize { waiter.signal } + @session.loop do + !@terminate_thread + end + end + end + waiter.wait(mutex) end end