From e614df90f3670f914b3ae54a1398eb1d1a91645e Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 14 Nov 2023 15:49:14 +0100 Subject: [PATCH] Drop dependency on mutex_m It doesn't really save much effort, and it's being extracted as a gem which cause issues for projects like spring that often are loaded before bundler. --- lib/spring/watcher/abstract.rb | 10 +++------- spring.gemspec | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/spring/watcher/abstract.rb b/lib/spring/watcher/abstract.rb index 108510e2..0f7b4406 100644 --- a/lib/spring/watcher/abstract.rb +++ b/lib/spring/watcher/abstract.rb @@ -1,5 +1,4 @@ require "pathname" -require "mutex_m" module Spring module Watcher @@ -9,13 +8,10 @@ module Watcher # IO.select([watcher]) # watcher is running in background # watcher.stale? # => true class Abstract - include Mutex_m - attr_reader :files, :directories, :root, :latency def initialize(root, latency) - super() - + @mutex = Mutex.new @root = File.realpath(root) @latency = latency @files = {} @@ -59,7 +55,7 @@ def add(*items) end end - synchronize { + @mutex.synchronize do items.each do |item| if item.directory? directories[item.realpath.to_s] = true @@ -75,7 +71,7 @@ def add(*items) end subjects_changed - } + end end def stale? diff --git a/spring.gemspec b/spring.gemspec index 9fa76bb9..99834785 100644 --- a/spring.gemspec +++ b/spring.gemspec @@ -15,8 +15,6 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.7.0" - gem.add_dependency 'mutex_m' - gem.add_development_dependency 'rake' gem.add_development_dependency 'bump' gem.add_development_dependency 'activesupport'