aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-07-08 16:10:41 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-07-08 16:10:57 -0700
commite5f0c0c548fd68a35902d4106130f099427aa98b (patch)
tree269004f2c6884f22c4f77d6be1c5576b85ad488d /activerecord
parentdfb017274fde29775f95a090b805ec8f9c83d2a0 (diff)
downloadrails-e5f0c0c548fd68a35902d4106130f099427aa98b.tar.gz
rails-e5f0c0c548fd68a35902d4106130f099427aa98b.tar.bz2
rails-e5f0c0c548fd68a35902d4106130f099427aa98b.zip
use latches rather than mucking with the scheduler
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/base_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 395f28f280..3a1830a739 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -1,4 +1,5 @@
require "cases/helper"
+require 'active_support/concurrency/latch'
require 'models/post'
require 'models/author'
require 'models/topic'
@@ -1458,21 +1459,20 @@ class BasicsTest < ActiveRecord::TestCase
orig_handler = klass.connection_handler
new_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
after_handler = nil
- is_set = false
+ latch1 = ActiveSupport::Concurrency::Latch.new
+ latch2 = ActiveSupport::Concurrency::Latch.new
t = Thread.new do
klass.connection_handler = new_handler
- is_set = true
- Thread.stop
+ latch1.release
+ latch2.await
after_handler = klass.connection_handler
end
- while(!is_set)
- Thread.pass
- end
+ latch1.await
klass.connection_handler = orig_handler
- t.wakeup
+ latch2.release
t.join
assert_equal after_handler, new_handler