thread 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/thread/channel.rb +12 -8
- data/thread.gemspec +1 -1
- 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: 915dd79486e7e628d223363cc58d22072872ba2e
|
4
|
+
data.tar.gz: 2a4c8d5cf1c04be29d42a29378eac723aed48907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4049d70035accffa58a8640564716f169f48f65a18e5eb7e4eb7b3c353f71be3610339e6179edaa56ac76abae3e6d94ac214df59fbcbaadb22cf2d8152c215
|
7
|
+
data.tar.gz: 1fe65f80b58a88d04c3b9de5cecd1f2d5bcf0a569b78f3dc5d6c8f5ee2c533b4ab70a8d367c089029ec8fb68d8a6a337fb953f36d1cc1f4c44b772dad7c1f6e6
|
data/lib/thread/channel.rb
CHANGED
@@ -49,10 +49,9 @@ class Thread::Channel
|
|
49
49
|
# If a block is passed, it's used as guard to match to a message.
|
50
50
|
def receive (&block)
|
51
51
|
message = nil
|
52
|
+
found = false
|
52
53
|
|
53
54
|
if block
|
54
|
-
found = false
|
55
|
-
|
56
55
|
until found
|
57
56
|
@mutex.synchronize {
|
58
57
|
if index = @messages.find_index(&block)
|
@@ -64,13 +63,18 @@ class Thread::Channel
|
|
64
63
|
}
|
65
64
|
end
|
66
65
|
else
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
until found
|
67
|
+
@mutex.synchronize {
|
68
|
+
if @messages.empty?
|
69
|
+
cond.wait @mutex
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
unless @messages.empty?
|
73
|
+
message = @messages.shift
|
74
|
+
found = true
|
75
|
+
end
|
76
|
+
}
|
77
|
+
end
|
74
78
|
end
|
75
79
|
|
76
80
|
message
|
data/thread.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thread
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meh.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|