futex 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/futex.gemspec +1 -1
  3. data/lib/futex.rb +5 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc966cb2da1f00c01883f0c460f481110c8fa74ee6aa6b10ce4a1355d40d211b
4
- data.tar.gz: c9e9794071fe3e2984bd6a411dd57fd20b9a4e67a18cd4843b60a609bd212aff
3
+ metadata.gz: c7d43b57ed9b9c1976f33c1da3d39e9646bbb5e890594c339ca7178da830db81
4
+ data.tar.gz: 7584b99738962f3526367c4310a5a626e8bcec599e5064350825f7a784ab0fac
5
5
  SHA512:
6
- metadata.gz: 86431c6b633f2d3485ca2321110853c198904682b5498a2cb439b702be54e012ab0b3204887e893a92c116111d04d36fa841c8a72edac6f41f8939bfe1f2683a
7
- data.tar.gz: e77aa4ee5b397613df270f476f69e2297b4e26f18296391a9e4b9421201a368d9e992afa06ddaa7f5580e91944b141f64b0d31f9614e379f261da7e220edf76e
6
+ metadata.gz: 8af3cb3b44c1e665d0a7744b5321b2084844d1b8c31b73cc37ea1abe47cc6e9c30ace004fd6abac823998a3584385ac18de237bebd53fc6702df186e2646b0bf
7
+ data.tar.gz: c99a473b9ecf837cfc95d852ce2e5886b492ce19cba9929cc3dbaef70f80d8bccbb182f9ae08006f6e5ae35611af2819ef0ae4532e00670f6c91c75016a52c90
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.3.0'
34
+ s.version = '0.3.1'
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
@@ -60,17 +60,17 @@ class Futex
60
60
  cycle += 1
61
61
  if Time.now - start > @timeout
62
62
  raise "##{Process.pid}/#{Thread.current.name} can't get \
63
- exclusive access to the file #{@path} \
64
- because of the lock at #{@lock}, after #{age(start)} \
65
- of waiting: #{IO.read(@lock)}"
63
+ exclusive access to the file #{@path} \
64
+ because of the lock at #{@lock}, after #{age(start)} \
65
+ of waiting: #{IO.read(@lock)}"
66
66
  end
67
67
  if (cycle % step).zero? && Time.now - start > @timeout / 2
68
68
  debug("##{Process.pid}/#{Thread.current.name} still waiting for \
69
- exclusive access to #{@path}, #{age(start)} already: #{IO.read(@lock)}")
69
+ exclusive access to #{@path}, #{age(start)} already: #{IO.read(@lock)}")
70
70
  end
71
71
  end
72
72
  debug("Locked by \"#{Thread.current.name}\" in #{age(start)}: #{@path} \
73
- (attempt no.#{cycle})")
73
+ (attempt no.#{cycle})")
74
74
  File.write(@lock, "##{Process.pid}/#{Thread.current.name}")
75
75
  acq = Time.now
76
76
  res = yield(@path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko