concurrent-ruby 0.3.1.pre.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +27 -32
- data/lib/concurrent/version.rb +1 -1
- metadata +16 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f88c2ee3113049d6c98628f54585643f62329249
|
4
|
+
data.tar.gz: 710552f92a683ba9a66ec30f8ea07567890e5dfe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d13cfa849aed3f685ba1282f93ee9558bca755cc4c52cfc2b6531f8f585282735f827f89a465fda7c8a0765cdd1aa343477b6d764ee7f1a775ab6048e06ed97d
|
7
|
+
data.tar.gz: 0e70b81e3930680b8771ed2b754425d6786f57ac2b07ebbda3bf4d570b07533e0f388dd430835d8323e9d1c3e9687336543cc97d5dfdb43c601323211bac884a
|
data/README.md
CHANGED
@@ -114,28 +114,27 @@ require 'concurrent'
|
|
114
114
|
|
115
115
|
### Examples
|
116
116
|
|
117
|
-
For complete examples, see the specific documentation
|
117
|
+
For complete examples, see the specific documentation for each abstraction.
|
118
|
+
The examples below are just basic usage.
|
118
119
|
|
119
120
|
#### Goroutine (Go)
|
120
121
|
|
122
|
+
Full documentation: [Goroutine](https://github.com/jdantonio/concurrent-ruby/blob/master/md/goroutine.md)
|
123
|
+
|
121
124
|
```ruby
|
122
125
|
require 'concurrent'
|
123
126
|
|
124
127
|
go('foo'){|echo| sleep(0.1); print "#{echo}\n"; sleep(0.1); print "Boom!\n" }
|
125
|
-
go('bar'){|echo| sleep(0.1); print "#{echo}\n"; sleep(0.1); print "Pow!\n" }
|
126
|
-
go('baz'){|echo| sleep(0.1); print "#{echo}\n"; sleep(0.1); print "Zap!\n" }
|
127
128
|
sleep(0.5)
|
128
129
|
|
129
130
|
#=> foo
|
130
|
-
#=> bar
|
131
|
-
#=> baz
|
132
131
|
#=> Boom!
|
133
|
-
#=> Pow!
|
134
|
-
#=> Zap!
|
135
132
|
```
|
136
133
|
|
137
134
|
#### Agent (Clojure)
|
138
135
|
|
136
|
+
Full documentation: [Agent](https://github.com/jdantonio/concurrent-ruby/blob/master/md/agent.md)
|
137
|
+
|
139
138
|
```ruby
|
140
139
|
require 'concurrent'
|
141
140
|
|
@@ -145,18 +144,12 @@ score.value #=> 10
|
|
145
144
|
score << proc{|current| current + 100 }
|
146
145
|
sleep(0.1)
|
147
146
|
score.value #=> 110
|
148
|
-
|
149
|
-
score << proc{|current| current * 2 }
|
150
|
-
sleep(0.1)
|
151
|
-
score.value #=> 220
|
152
|
-
|
153
|
-
score << proc{|current| current - 50 }
|
154
|
-
sleep(0.1)
|
155
|
-
score.value #=> 170
|
156
147
|
```
|
157
148
|
|
158
149
|
#### Future (Clojure)
|
159
150
|
|
151
|
+
Full documentation: [Future](https://github.com/jdantonio/concurrent-ruby/blob/master/md/future.md)
|
152
|
+
|
160
153
|
```ruby
|
161
154
|
require 'concurrent'
|
162
155
|
|
@@ -168,6 +161,8 @@ count.value #=> 10 (after blocking)
|
|
168
161
|
|
169
162
|
#### Promise (JavaScript)
|
170
163
|
|
164
|
+
Full documentation: [Promise](https://github.com/jdantonio/concurrent-ruby/blob/master/md/promise.md)
|
165
|
+
|
171
166
|
```ruby
|
172
167
|
require 'concurrent'
|
173
168
|
|
@@ -181,6 +176,8 @@ p.value #=> "Hello Jerry D'Antonio. Would you like to play a game?"
|
|
181
176
|
|
182
177
|
#### Thread Pools (Java)
|
183
178
|
|
179
|
+
Full documentation: [Thread Pools](https://github.com/jdantonio/concurrent-ruby/blob/master/md/thread_pool.md)
|
180
|
+
|
184
181
|
```ruby
|
185
182
|
require 'concurrent'
|
186
183
|
|
@@ -189,36 +186,24 @@ pool.size #=> 2
|
|
189
186
|
|
190
187
|
pool.post{ sleep(0.5); print "Boom!\n" }
|
191
188
|
pool.size #=> 2
|
192
|
-
pool.post{ sleep(0.5); print "Pow!\n" }
|
193
|
-
pool.size #=> 2
|
194
|
-
pool.post{ sleep(0.5); print "Zap!\n" }
|
195
|
-
pool.size #=> 2
|
196
189
|
|
197
190
|
sleep(1)
|
198
|
-
|
199
191
|
#=> Boom!
|
200
|
-
#=> Pow!
|
201
|
-
#=> Zap!
|
202
192
|
|
203
193
|
pool = Concurrent::CachedThreadPool.new
|
204
194
|
pool.size #=> 0
|
205
195
|
|
206
196
|
pool << proc{ sleep(0.5); print "Boom!\n" }
|
207
197
|
pool.size #=> 1
|
208
|
-
pool << proc{ sleep(0.5); print "Pow!\n" }
|
209
|
-
pool.size #=> 2
|
210
|
-
pool << proc{ sleep(0.5); print "Zap!\n" }
|
211
|
-
pool.size #=> 3
|
212
198
|
|
213
199
|
sleep(1)
|
214
|
-
|
215
200
|
#=> Boom!
|
216
|
-
#=> Pow!
|
217
|
-
#=> Zap!
|
218
201
|
```
|
219
202
|
|
220
203
|
#### TimerTask (Java)
|
221
204
|
|
205
|
+
Full documentation: [TimerTask](https://github.com/jdantonio/concurrent-ruby/blob/master/md/timer_task.md)
|
206
|
+
|
222
207
|
```ruby
|
223
208
|
require 'concurrent'
|
224
209
|
|
@@ -234,8 +219,16 @@ ec.status #=> "sleep"
|
|
234
219
|
ec.kill #=> true
|
235
220
|
```
|
236
221
|
|
222
|
+
#### ScheduledTask (Java)
|
223
|
+
|
224
|
+
Full documentation: [ScheduledTask](https://github.com/jdantonio/concurrent-ruby/blob/master/md/scheduled_task.md)
|
225
|
+
|
226
|
+
*TBD*
|
227
|
+
|
237
228
|
#### Actor (Scala)
|
238
229
|
|
230
|
+
Full documentation: [Actor](https://github.com/jdantonio/concurrent-ruby/blob/master/md/actor.md)
|
231
|
+
|
239
232
|
```ruby
|
240
233
|
class FinanceActor < Concurrent::Actor
|
241
234
|
def act(query)
|
@@ -253,6 +246,8 @@ pool << 'google'
|
|
253
246
|
|
254
247
|
#### Supervisor (Erlang)
|
255
248
|
|
249
|
+
Full documentation: [Supervisor](https://github.com/jdantonio/concurrent-ruby/blob/master/md/supervisor.md)
|
250
|
+
|
256
251
|
```ruby
|
257
252
|
pong = Pong.new
|
258
253
|
ping = Ping.new(10000, pong)
|
@@ -276,9 +271,9 @@ ping << :pong
|
|
276
271
|
* [Data Parallelism](http://msdn.microsoft.com/en-us/library/dd537608.aspx)
|
277
272
|
* [Task Parallelism](http://msdn.microsoft.com/en-us/library/dd537609.aspx)
|
278
273
|
* More Erlang goodness
|
279
|
-
* gen_server
|
280
|
-
* gen_event
|
281
|
-
* gen_fsm
|
274
|
+
* [gen_server](http://www.erlang.org/doc/man/gen_server.html)
|
275
|
+
* [gen_event](http://www.erlang.org/doc/man/gen_event.html)
|
276
|
+
* [gen_fsm](http://www.erlang.org/doc/man/gen_fsm.html)
|
282
277
|
|
283
278
|
## Contributing
|
284
279
|
|
data/lib/concurrent/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrent-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.1
|
5
|
-
prerelease: 6
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jerry D'Antonio
|
@@ -14,22 +13,20 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
|
-
description:
|
31
|
-
|
32
|
-
|
27
|
+
description: |2
|
28
|
+
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
|
29
|
+
Inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency patterns.
|
33
30
|
email: jerry.dantonio@gmail.com
|
34
31
|
executables: []
|
35
32
|
extensions: []
|
@@ -98,28 +95,29 @@ files:
|
|
98
95
|
homepage: http://www.concurrent-ruby.com
|
99
96
|
licenses:
|
100
97
|
- MIT
|
101
|
-
|
102
|
-
|
98
|
+
metadata: {}
|
99
|
+
post_install_message: |2
|
100
|
+
future = Concurrent::Future.new{ 'Hello, world!' }
|
101
|
+
puts future.value
|
102
|
+
#=> Hello, world!
|
103
103
|
rdoc_options: []
|
104
104
|
require_paths:
|
105
105
|
- lib
|
106
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
107
|
requirements:
|
109
|
-
- -
|
108
|
+
- - '>='
|
110
109
|
- !ruby/object:Gem::Version
|
111
110
|
version: 1.9.2
|
112
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
112
|
requirements:
|
115
|
-
- -
|
113
|
+
- - '>='
|
116
114
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
115
|
+
version: '0'
|
118
116
|
requirements: []
|
119
117
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.
|
118
|
+
rubygems_version: 2.1.10
|
121
119
|
signing_key:
|
122
|
-
specification_version:
|
120
|
+
specification_version: 4
|
123
121
|
summary: Modern concurrency tools including agents, futures, promises, thread pools,
|
124
122
|
actors, and more.
|
125
123
|
test_files:
|
@@ -145,4 +143,3 @@ test_files:
|
|
145
143
|
- spec/concurrent/utilities_spec.rb
|
146
144
|
- spec/spec_helper.rb
|
147
145
|
- spec/support/functions.rb
|
148
|
-
has_rdoc:
|