async-container 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45319be8ef742bece1def74c0ac58a0bb3450f3bec0c80dc34eca3bf28f284eb
4
- data.tar.gz: 400b19815897816a89b529a45c95a036a95feb5eed59cc615d88542933d6d974
3
+ metadata.gz: 75087d509178518dc7ec8da7edf7420311f298907ffaf997a4895c5ab584b6da
4
+ data.tar.gz: a1c449cea506ace5afdc7ea81bfb7c7b1a804389dc7e36d77ea3b69f999461e6
5
5
  SHA512:
6
- metadata.gz: 91fe53a2d4276196a4dedeb0b66a09c35acb55c06a2f1c7ab5c2708536b40f79914a78d02f1919ca6125cfe68a6b4c1ec967493452262f736f57c751c63b23eb
7
- data.tar.gz: 027e9c42c8baa011019ffb42e82646194fff2d54c3a902323aae2d64646f35a224052c309ce5a118c2b4255052616165422c90b42c56f65b0381a73493bb8a19
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)
@@ -43,8 +43,8 @@ module Async
43
43
  end
44
44
 
45
45
  @threads = @reactors.collect do |reactor|
46
- Thread.new do
47
- thread = Thread.current
46
+ ::Thread.new do
47
+ thread = ::Thread.current
48
48
 
49
49
  thread.abort_on_exception = true
50
50
  thread.name = name if name
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module Container
23
- VERSION = "0.8.0"
23
+ VERSION = "0.8.1"
24
24
  end
25
25
  end
@@ -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(concurrency: 8, name: "Sleepy Jerry") do |task, instance|
26
- instance.name = "Hello World"
27
-
28
- sleep 1
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
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Process.setproctitle "Preparing for sleep..."
4
+
5
+ 10.times do |i|
6
+ puts "Counting sheep #{i}"
7
+ Process.setproctitle "Counting sheep #{i}"
8
+
9
+ sleep 10
10
+ end
11
+
12
+ puts "Zzzzzzz"
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.0
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