futex 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/futex.gemspec +1 -1
- data/lib/futex.rb +1 -1
- data/test/test_futex.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5106ee1a1a428a57559341311f6f66cdcff6b0d15453b1925e0ad570bf4f5a6
|
4
|
+
data.tar.gz: 88ff9063aff0aa87a71426808fd82b3324e5a819d3a3669f83e2900fb673dec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68f618ed73bee632c43c350812cbf88aa1107871d15561e5cb76f9127fa29e5c223b523d31e34289dc87031b9b13bf5422ca6d6e031a675e934594551cfb822f
|
7
|
+
data.tar.gz: 7d666e9b80b81670bab473327c30dbd91a178ebf1690c0aae6c469d76099faf38a4fef0028b0596b94faa44f392a5eee384c2352b5e5c2184aded3124f650f57
|
data/.rubocop.yml
CHANGED
data/futex.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.rubygems_version = '2.3.3'
|
32
32
|
s.required_ruby_version = '>=2.3'
|
33
33
|
s.name = 'futex'
|
34
|
-
s.version = '0.
|
34
|
+
s.version = '0.6.0'
|
35
35
|
s.license = 'MIT'
|
36
36
|
s.summary = 'File-based mutex'
|
37
37
|
s.description = 'Ruby Gem for file-based locking'
|
data/lib/futex.rb
CHANGED
@@ -107,7 +107,7 @@ access to #{@path}, #{age(start)} already: #{IO.read(@lock)}")
|
|
107
107
|
def badge(exclusive)
|
108
108
|
tname = Thread.current.name
|
109
109
|
tname = 'nil' if tname.nil?
|
110
|
-
"##{Process.pid}-#{exclusive ? 'ex' : 'sh'}/#{tname}"
|
110
|
+
"##{Process.pid}-#{exclusive ? 'ex' : 'sh'}/#{tname}[#{caller(2..2).first}]"
|
111
111
|
end
|
112
112
|
|
113
113
|
def age(time)
|
data/test/test_futex.rb
CHANGED
@@ -135,9 +135,18 @@ class FutexTest < Minitest::Test
|
|
135
135
|
Thread.current.thread_variable_get(:futex_lock)
|
136
136
|
)
|
137
137
|
assert(
|
138
|
-
Thread.current.thread_variable_get(:futex_badge).
|
138
|
+
Thread.current.thread_variable_get(:futex_badge).include?('-ex/nil')
|
139
139
|
)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
143
|
+
|
144
|
+
def test_saves_calling_file_name_in_lock
|
145
|
+
Dir.mktmpdir do |dir|
|
146
|
+
Futex.new(File.join(dir, 'hey.txt')).open do |f|
|
147
|
+
badge = IO.read("#{f}.lock")
|
148
|
+
assert(badge.include?('test/test_futex.rb:'), badge)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
143
152
|
end
|