pb_actor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d0cf1ea9d8a2f2a20ad8f90ef852e74182c42ca
4
- data.tar.gz: 8077c6562b7ff8c7f1cc60aea93884f907415dfb
3
+ metadata.gz: ed926fafad75713c566df0ac82704631c29ecff0
4
+ data.tar.gz: 7d74986b42da2262ba4dc3a04d3786a47996c2e0
5
5
  SHA512:
6
- metadata.gz: a812dc4a3616d5cbd13fb03ebafc5dba50b9cacd2611ecda4a95cecf61c43363895182af8453cfbc0aff01140432aa1bf8b5e6381e7bfb36e229aa146f3b7c9e
7
- data.tar.gz: 2fe7ccd11918ed2f751130e3f957dd89dc08cd377fff7d86e5c8a8a2c3671aa4a5e35d2106edbd513fe838acd8e81a35d7075d0acce8515a50c895c5e42227c4
6
+ metadata.gz: a1268f95cb59df589117fad9822cf02c433c1cd1ffb611ead131377aecaf97def664979f60d2725a61f4f46f9dab17524f44e469912d0e525970eda6bc4b5fc0
7
+ data.tar.gz: f6d686f57c195f8ab3cd6400163b6905402df5b31b1a1b2f8b42b2af413a943e34b98c018b935e3c942761b7b0608cf42eb790e55560524fd69613a495dfba87
@@ -7,10 +7,9 @@ module PbActor
7
7
  end
8
8
 
9
9
  def alive?
10
- # Have any other way to check a process status?
11
- !timeout(0.001){@rd.eof?}
12
- rescue Timeout::Error => e
13
- true
10
+ !Process.waitpid @pid, Process::WNOHANG
11
+ rescue Errno::ECHILD => e
12
+ false
14
13
  end
15
14
 
16
15
  def method_missing method, *args, &blk
@@ -9,6 +9,8 @@ module PbActor
9
9
 
10
10
  def recv rd
11
11
  Marshal.load rd
12
+ rescue EOFError => e
13
+ raise DeadActorError, 'dead actor call'
12
14
  end
13
15
  end
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module PbActor
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe PbActor::Message do
4
+ before :each do
5
+ @r, @w = IO.pipe
6
+ end
7
+
8
+ after :each do
9
+ [@r, @w].each do |io|
10
+ io.close unless io.closed?
11
+ end
12
+ end
13
+
14
+ it 'send should broken when read io close' do
15
+ @r.close
16
+ expect{PbActor::Message.send "message", @w}.to raise_error(PbActor::DeadActorError)
17
+ end
18
+
19
+ it 'recv should broken when write io close' do
20
+ @w.close
21
+ expect{PbActor::Message.recv @r}.to raise_error(PbActor::DeadActorError)
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pb_actor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jjy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-13 00:00:00.000000000 Z
11
+ date: 2013-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,6 +59,7 @@ files:
59
59
  - lib/pb_actor/proxy.rb
60
60
  - lib/pb_actor/version.rb
61
61
  - pb_actor.gemspec
62
+ - spec/message_spec.rb
62
63
  - spec/pb_actor_spec.rb
63
64
  - spec/spec_helper.rb
64
65
  homepage: https://github.com/jjyr/pb_actor
@@ -81,10 +82,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  version: '0'
82
83
  requirements: []
83
84
  rubyforge_project:
84
- rubygems_version: 2.0.3
85
+ rubygems_version: 2.0.6
85
86
  signing_key:
86
87
  specification_version: 4
87
88
  summary: Just for fun.
88
89
  test_files:
90
+ - spec/message_spec.rb
89
91
  - spec/pb_actor_spec.rb
90
92
  - spec/spec_helper.rb