async-container 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/container/forked.rb +2 -2
- data/lib/async/container/threaded.rb +2 -2
- data/lib/async/container/version.rb +1 -1
- data/spec/async/container/forked_spec.rb +7 -4
- data/title.rb +12 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75087d509178518dc7ec8da7edf7420311f298907ffaf997a4895c5ab584b6da
|
4
|
+
data.tar.gz: a1c449cea506ace5afdc7ea81bfb7c7b1a804389dc7e36d77ea3b69f999461e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8a261648ae40a4799533509308f9d118f86dfe5478e660b4863ff26991455d2345f153ab88c375bcdfc2db7c2eb5a03989745c884745d7147e88b4b801e338
|
7
|
+
data.tar.gz: a746d675bf3477d0f854055fedf13c76484630e7b1a374ff836e9bfc3e52b9ba2a34db3c4919d78f5b57b8c241bfe7ea536429528f5a30701598cdd8fe404e9d
|
@@ -31,14 +31,14 @@ module Async
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def name= value
|
34
|
-
Process.setproctitle(value)
|
34
|
+
::Process.setproctitle(value)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def initialize(concurrency: 1, name: nil, &block)
|
39
39
|
@pids = concurrency.times.collect do
|
40
40
|
fork do
|
41
|
-
Process.setproctitle(name) if name
|
41
|
+
::Process.setproctitle(name) if name
|
42
42
|
|
43
43
|
begin
|
44
44
|
Async::Reactor.run(Instance.new, &block)
|
@@ -22,10 +22,13 @@ require "async/container/forked"
|
|
22
22
|
|
23
23
|
RSpec.describe Async::Container::Forked do
|
24
24
|
it "can run concurrently" do
|
25
|
-
container = described_class.new(
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
container = described_class.new(name: "Sleepy Jerry") do |task, instance|
|
26
|
+
3.times do |i|
|
27
|
+
puts "Counting Sheep #{i}"
|
28
|
+
instance.name = "Counting Sheep #{i}"
|
29
|
+
|
30
|
+
sleep 2
|
31
|
+
end
|
29
32
|
end
|
30
33
|
|
31
34
|
container.wait
|
data/title.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- spec/async/container/threaded_spec.rb
|
123
123
|
- spec/async/container_spec.rb
|
124
124
|
- spec/spec_helper.rb
|
125
|
+
- title.rb
|
125
126
|
homepage: https://github.com/socketry/async-container
|
126
127
|
licenses:
|
127
128
|
- MIT
|