Skip to content

Commit f7e452e

Browse files
authored
Merge pull request #703 from rails/drop-mutex-m
Drop dependency on mutex_m
2 parents 6b2001f + 4a5368c commit f7e452e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

lib/spring/watcher/abstract.rb

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require "pathname"
2-
require "mutex_m"
32

43
module Spring
54
module Watcher
@@ -9,13 +8,10 @@ module Watcher
98
# IO.select([watcher]) # watcher is running in background
109
# watcher.stale? # => true
1110
class Abstract
12-
include Mutex_m
13-
1411
attr_reader :files, :directories, :root, :latency
1512

1613
def initialize(root, latency)
17-
super()
18-
14+
@mutex = Mutex.new
1915
@root = File.realpath(root)
2016
@latency = latency
2117
@files = {}
@@ -59,7 +55,7 @@ def add(*items)
5955
end
6056
end
6157

62-
synchronize {
58+
@mutex.synchronize do
6359
items.each do |item|
6460
if item.directory?
6561
directories[item.realpath.to_s] = true
@@ -75,7 +71,7 @@ def add(*items)
7571
end
7672

7773
subjects_changed
78-
}
74+
end
7975
end
8076

8177
def stale?

lib/spring/watcher/polling.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def initialize(root, latency)
1212
end
1313

1414
def check_stale
15-
synchronize do
15+
@mutex.synchronize do
1616
computed = compute_mtime
1717
if mtime < computed
1818
debug { "check_stale: mtime=#{mtime.inspect} < computed=#{computed.inspect}" }

spring.gemspec

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Gem::Specification.new do |gem|
1515

1616
gem.required_ruby_version = ">= 2.7.0"
1717

18-
gem.add_dependency 'mutex_m'
19-
2018
gem.add_development_dependency 'rake'
2119
gem.add_development_dependency 'bump'
2220
gem.add_development_dependency 'activesupport'

0 commit comments

Comments
 (0)