rubysl-thread 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +12 -7
- data/MRI_LICENSE +56 -0
- data/lib/rubysl/thread/thread.rb +10 -10
- data/lib/rubysl/thread/version.rb +1 -1
- metadata +29 -29
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDI5Y2MxMWQ2NzA2YTUyYjA0YmUwMWYyYzk4YjFkZDZjMThiNzgxMDIzMjc4
|
10
|
-
NWEyMDUxYWFhNmRkNjVmNDY5NWM4NzYxYzk1MjJlOGExZGIzMmZhMGFlMmI4
|
11
|
-
NmE0OTUzMjhhMDFjODAxMzA2YWVjNTIxODk4MGE2NmVkMTdhZWU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWY2ZWJmNDZjYjQ5ZmZkZTZhZmNmMjEyOTU0NWM4OTZjNmVkZDM1NmJhYzJm
|
14
|
-
YjI1NzdlNDZjOWVkZDk3ODdkNjlhODllNDljZjcyNGZkMzc1YTUwZWRmZWM4
|
15
|
-
ZTFmNTI4NzQ1ODkzMWUwMjFkMDVjYjU4ZmVmZmRlYTQ3NDYwMjA=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a55f798bae750c6f72088c3d3675323adccd2616
|
4
|
+
data.tar.gz: 322ab9989a8977bc3ae9e46e1ffea6df8feba31c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 29ae78fbba23d0d51127317417c976ec2e2bfdad470d25d64b082421b395bbe45d9008840e9e84a77381e92c293a37e932dd4a101ac29599b625e5d75d3765cc
|
7
|
+
data.tar.gz: 77c41221f5c8a4d8b99e06421e6e36f2b24efadedaf212ba82ef65e54430b5d639dad3685209763617231933d02045c98e91e10e34671a2fcfa36336b5901783
|
data/.travis.yml
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
language: ruby
|
2
|
-
before_install:
|
3
|
-
- rvm use $RVM --install --binary --fuzzy
|
4
|
-
- gem update --system
|
5
|
-
- gem --version
|
6
|
-
- gem install rubysl-bundler
|
7
2
|
env:
|
8
|
-
-
|
9
|
-
|
3
|
+
- RUBYLIB=lib
|
4
|
+
- RUBYLIB=
|
5
|
+
script: mspec spec
|
6
|
+
rvm:
|
7
|
+
- 2.0.0
|
8
|
+
- rbx-2.2.1
|
9
|
+
matrix:
|
10
|
+
exclude:
|
11
|
+
- rvm: 2.0.0
|
12
|
+
env: RUBYLIB=lib
|
13
|
+
- rvm: rbx-2.2.1
|
14
|
+
env: RUBYLIB=
|
data/MRI_LICENSE
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a) place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b) use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c) give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d) make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a) distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b) accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c) give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d) make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/lib/rubysl/thread/thread.rb
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
#
|
24
24
|
# mutex = Mutex.new
|
25
25
|
# resource = ConditionVariable.new
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# a = Thread.new {
|
28
28
|
# mutex.synchronize {
|
29
29
|
# # Thread 'a' now needs the resource
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
# # 'a' can now have the resource
|
32
32
|
# }
|
33
33
|
# }
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# b = Thread.new {
|
36
36
|
# mutex.synchronize {
|
37
37
|
# # Thread 'b' has finished using the resource
|
@@ -115,9 +115,9 @@ end
|
|
115
115
|
# Example:
|
116
116
|
#
|
117
117
|
# require 'thread'
|
118
|
-
#
|
118
|
+
#
|
119
119
|
# queue = Queue.new
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# producer = Thread.new do
|
122
122
|
# 5.times do |i|
|
123
123
|
# sleep rand(i) # simulate expense
|
@@ -125,7 +125,7 @@ end
|
|
125
125
|
# puts "#{i} produced"
|
126
126
|
# end
|
127
127
|
# end
|
128
|
-
#
|
128
|
+
#
|
129
129
|
# consumer = Thread.new do
|
130
130
|
# 5.times do |i|
|
131
131
|
# value = queue.pop
|
@@ -133,7 +133,7 @@ end
|
|
133
133
|
# puts "consumed #{value}"
|
134
134
|
# end
|
135
135
|
# end
|
136
|
-
#
|
136
|
+
#
|
137
137
|
# consumer.join
|
138
138
|
#
|
139
139
|
class Queue
|
@@ -272,7 +272,7 @@ class SizedQueue < Queue
|
|
272
272
|
def max=(max)
|
273
273
|
@size_mutex.synchronize do
|
274
274
|
@max = max
|
275
|
-
@sem.broadcast
|
275
|
+
@sem.broadcast
|
276
276
|
end
|
277
277
|
max
|
278
278
|
end
|
@@ -310,13 +310,13 @@ class SizedQueue < Queue
|
|
310
310
|
#
|
311
311
|
def pop(*args)
|
312
312
|
retval = super
|
313
|
-
|
313
|
+
|
314
314
|
@size_mutex.synchronize do
|
315
315
|
if @que.size < @max
|
316
316
|
@sem.broadcast
|
317
|
-
end
|
317
|
+
end
|
318
318
|
end
|
319
|
-
|
319
|
+
|
320
320
|
return retval
|
321
321
|
end
|
322
322
|
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-thread
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- - ~>
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '1.3'
|
19
|
-
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
20
22
|
version_requirements: !ruby/object:Gem::Requirement
|
21
23
|
requirements:
|
22
|
-
- - ~>
|
24
|
+
- - "~>"
|
23
25
|
- !ruby/object:Gem::Version
|
24
26
|
version: '1.3'
|
25
|
-
prerelease: false
|
26
|
-
type: :development
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '10.0'
|
33
|
-
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
34
36
|
version_requirements: !ruby/object:Gem::Requirement
|
35
37
|
requirements:
|
36
|
-
- - ~>
|
38
|
+
- - "~>"
|
37
39
|
- !ruby/object:Gem::Version
|
38
40
|
version: '10.0'
|
39
|
-
prerelease: false
|
40
|
-
type: :development
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: mspec
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- - ~>
|
45
|
+
- - "~>"
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '1.5'
|
47
|
-
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
48
50
|
version_requirements: !ruby/object:Gem::Requirement
|
49
51
|
requirements:
|
50
|
-
- - ~>
|
52
|
+
- - "~>"
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: '1.5'
|
53
|
-
prerelease: false
|
54
|
-
type: :development
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubysl-prettyprint
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
|
-
- - ~>
|
59
|
+
- - "~>"
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '2.0'
|
61
|
-
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
62
64
|
version_requirements: !ruby/object:Gem::Requirement
|
63
65
|
requirements:
|
64
|
-
- - ~>
|
66
|
+
- - "~>"
|
65
67
|
- !ruby/object:Gem::Version
|
66
68
|
version: '2.0'
|
67
|
-
prerelease: false
|
68
|
-
type: :development
|
69
69
|
description: Support classes for working with threads.
|
70
70
|
email:
|
71
71
|
- brixen@gmail.com
|
@@ -73,10 +73,11 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
78
|
- Gemfile
|
79
79
|
- LICENSE
|
80
|
+
- MRI_LICENSE
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
82
83
|
- lib/rubysl/thread.rb
|
@@ -95,18 +96,17 @@ require_paths:
|
|
95
96
|
- lib
|
96
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
98
|
requirements:
|
98
|
-
- - ~>
|
99
|
+
- - "~>"
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '2.0'
|
101
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
103
|
requirements:
|
103
|
-
- -
|
104
|
+
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
106
|
-
MA==
|
106
|
+
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.4.5
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Support classes for working with threads.
|