Permalink
Browse files

change require spec_helper, fix threadpool restart

  • Loading branch information...
1 parent 74391f5 commit 2b7e667c4030859ca4b2b0237574f5247aae0ce4 @slyphon slyphon committed Jun 7, 2011
@@ -72,14 +72,18 @@ def shutdown(timeout=2)
@threadqueue.clear
@size.times { @threadqueue << KILL_TOKEN }
- while th = @threadpool.shift
+ threads, @threadpool = @threadpool, []
+
+ while th = threads.shift
begin
th.join(timeout)
rescue Exception => e
logger.error { "Caught exception shutting down threadpool" }
logger.error { e.to_std_format }
end
end
+
+ @threadqueue = ::Queue.new
end
nil
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe ZK::Client do
before do
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe ZK::Election do
before do
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
# this is a remnant of the old Locker class, but a good test of what's expected
# from ZK::Client#locker
@@ -1,4 +1,4 @@
-require File.expand_path('../spec_helper', __FILE__)
+require 'spec_helper'
require 'tracer'
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
require 'tracer'
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe ZK::Threadpool do
@@ -55,14 +55,13 @@
describe :start! do
it %[should be able to start a threadpool that had previously been shutdown (reuse)] do
@threadpool.shutdown
- @threadpool.start!
+ @threadpool.start!.should be_true
@threadpool.should be_running
@rval = nil
@threadpool.defer do
- $stderr.puts "block called!"
@rval = true
end

0 comments on commit 2b7e667

Please sign in to comment.