Permalink
Browse files

Use run_count instead of process_counter

  • Loading branch information...
1 parent 8308b6a commit 3b61bbe7ac0c649e119ab097180125797d9ca792 @phuongnd08 committed Feb 18, 2012
Showing with 9 additions and 12 deletions.
  1. +8 −11 lib/spork.rb
  2. +1 −1 lib/spork/run_strategy/forking.rb
View
@@ -13,16 +13,19 @@ module Spork
autoload :Diagnoser, (LIBDIR + 'spork/diagnoser').to_s
autoload :GemHelpers, (LIBDIR + 'spork/gem_helpers').to_s
- @process_counter_semaphore = Mutex.new
+ @run_count_semaphore = Mutex.new
class << self
- def process_counter
- @process_counter || 0
+ def run_count
+ @run_count || 0
end
- def process_counter=(counter)
- @process_counter = counter
+ def increase_run_count
+ @run_count_semaphore.synchronize do
+ @run_count = 0 unless @run_count
+ @run_count += 1
+ end
end
# Run a block, during prefork mode. By default, if prefork is called twice in the same file and line number, the supplied block will only be ran once.
@@ -49,12 +52,6 @@ def each_run(prevent_double_run = true, &block)
end
end
- def increase_process_counter
- @process_counter_semaphore.synchronize do
- self.process_counter += 1
- end
- end
-
# Run a block after specs are run.
#
# == Parameters
@@ -4,7 +4,7 @@ def self.available?
end
def run(argv, stderr, stdout)
- Spork.increase_process_counter
+ Spork.increase_run_count
child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr

0 comments on commit 3b61bbe

Please sign in to comment.