celluloid-io 0.13.0 → 0.13.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.
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.13.1 (2013-04-04)
2
+ -------------------
3
+ * Fix major performance regression: I/O backpressure (i.e. EAGAIN
4
+ handling) was being double-dispatched through the actor protocol.
5
+
1
6
  0.13.0
2
7
  ------
3
8
  * Support for many, many more IO methods, particularly line-oriented
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'coveralls', require: false
5
- gem 'celluloid', github: 'celluloid/celluloid'
5
+ gem 'celluloid', github: 'celluloid/celluloid', branch: '0-13-stable'
data/lib/celluloid/io.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'forwardable'
2
1
  require 'celluloid/io/version'
3
2
 
4
3
  require 'celluloid'
@@ -24,9 +23,28 @@ module Celluloid
24
23
  klass.mailbox_class Celluloid::IO::Mailbox
25
24
  end
26
25
 
27
- extend Forwardable
26
+ def wait_readable(io)
27
+ io = io.to_io
28
+ actor = Thread.current[:celluloid_actor]
29
+ if actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
30
+ actor.mailbox.reactor.wait_readable(io)
31
+ else
32
+ Kernel.select([io])
33
+ end
34
+ nil
35
+ end
36
+ module_function :wait_readable
28
37
 
29
- # Wait for the given IO object to become readable/writable
30
- def_delegators 'current_actor.mailbox.reactor', :wait_readable, :wait_writable
38
+ def wait_writable(io)
39
+ io = io.to_io
40
+ actor = Thread.current[:celluloid_actor]
41
+ if actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
42
+ actor.mailbox.reactor.wait_writable(io)
43
+ else
44
+ Kernel.select([], [io])
45
+ end
46
+ nil
47
+ end
48
+ module_function :wait_writable
31
49
  end
32
50
  end
@@ -36,22 +36,10 @@ module Celluloid
36
36
  end
37
37
 
38
38
  # Wait until the current object is readable
39
- def wait_readable
40
- if evented?
41
- Celluloid.current_actor.wait_readable(self.to_io)
42
- else
43
- Kernel.select([self.to_io])
44
- end
45
- end
39
+ def wait_readable; Celluloid::IO.wait_readable(self); end
46
40
 
47
41
  # Wait until the current object is writable
48
- def wait_writable
49
- if evented?
50
- Celluloid.current_actor.wait_writable(self.to_io)
51
- else
52
- Kernel.select([], [self.to_io])
53
- end
54
- end
42
+ def wait_writable; Celluloid::IO.wait_writable(self); end
55
43
 
56
44
  # System read via the nonblocking subsystem
57
45
  def sysread(length = nil, buffer = nil)
@@ -12,18 +12,12 @@ module Celluloid
12
12
  end
13
13
 
14
14
  def accept
15
- actor = Thread.current[:celluloid_actor]
16
-
17
- if evented?
18
- Celluloid.current_actor.wait_readable @server
19
- accept_nonblock
20
- else
21
- Celluloid::IO::TCPSocket.from_ruby_socket @server.accept
22
- end
15
+ Celluloid::IO.wait_readable(@server)
16
+ accept_nonblock
23
17
  end
24
18
 
25
19
  def accept_nonblock
26
- Celluloid::IO::TCPSocket.from_ruby_socket @server.accept_nonblock
20
+ Celluloid::IO::TCPSocket.new(@server.accept_nonblock)
27
21
  end
28
22
 
29
23
  def to_io
@@ -16,13 +16,7 @@ module Celluloid
16
16
  end
17
17
 
18
18
  # Wait until the socket is readable
19
- def wait_readable
20
- if evented?
21
- Celluloid.current_actor.wait_readable(@socket)
22
- else
23
- Kernel.select([@socket])
24
- end
25
- end
19
+ def wait_readable; Celluloid::IO.wait_readable(self); end
26
20
 
27
21
  # Receives up to maxlen bytes from socket. flags is zero or more of the
28
22
  # MSG_ options. The first element of the results, mesg, is the data
@@ -16,18 +16,12 @@ module Celluloid
16
16
  end
17
17
 
18
18
  def accept
19
- actor = Thread.current[:celluloid_actor]
20
-
21
- if evented?
22
- Celluloid.current_actor.wait_readable @server
23
- accept_nonblock
24
- else
25
- Celluloid::IO::UNIXSocket.from_ruby_socket @server.accept
26
- end
19
+ Celluloid::IO.wait_readable(@server)
20
+ accept_nonblock
27
21
  end
28
22
 
29
23
  def accept_nonblock
30
- Celluloid::IO::UNIXSocket.from_ruby_socket @server.accept_nonblock
24
+ Celluloid::IO::UNIXSocket.new(@server.accept_nonblock)
31
25
  end
32
26
 
33
27
  def to_io
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module IO
3
- VERSION = "0.13.0"
3
+ VERSION = "0.13.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-19 00:00:00.000000000 Z
12
+ date: 2013-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid