threadlock 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/threadlock.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690971678359590f806de448665ace8c671cbdf4
|
4
|
+
data.tar.gz: 976a934e2288dd3dbcdcba57eef942914b5c9de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1086f8452e7d52aed6c386ff39f04d9cc87c2aaa0aceca48f83c3fa8337a1bff2e407717c7d7169060a8f91a5f14f6f137ef09c683bd8fac0b2553798c7fcb
|
7
|
+
data.tar.gz: c2f5a307cecf7b83bf00a616527de51833ba22c417d2b4f113a7adff227adbed58d2259e6313aa99b7136a39e1129b582f2908b27f6f5c534e7a9e7ce1f2109e
|
data/lib/threadlock.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'monitor'
|
2
2
|
|
3
|
-
def threadlock(*funcs)
|
3
|
+
def threadlock(*funcs, lock: :@___threadlock___)
|
4
4
|
for f in funcs.flatten
|
5
5
|
f2 = f.to_s
|
6
6
|
.gsub(/\=/, "_eQUAL")
|
@@ -19,8 +19,8 @@ def threadlock(*funcs)
|
|
19
19
|
("
|
20
20
|
alias :#{f2} :#{f}
|
21
21
|
def #{f}(*args)
|
22
|
-
|
23
|
-
|
22
|
+
#{lock.to_s} ||= Monitor.new
|
23
|
+
#{lock.to_s}.synchronize do
|
24
24
|
#{f2}(*args)
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: threadlock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe McIlvain
|
@@ -50,5 +50,5 @@ rubyforge_project:
|
|
50
50
|
rubygems_version: 2.0.2
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
|
-
summary: threadlock
|
53
|
+
summary: 'threadlock: Easy, featherweight thread protection for basic ruby objects.'
|
54
54
|
test_files: []
|