nio4r 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -1
- data/Gemfile +11 -3
- data/README.md +8 -6
- data/ext/nio4r/org/nio4r/Nio4r.java +6 -1
- data/lib/nio.rb +5 -3
- data/lib/nio/monitor.rb +1 -1
- data/lib/nio/selector.rb +1 -5
- data/lib/nio/version.rb +3 -1
- data/nio4r.gemspec +1 -3
- data/spec/nio/selector_spec.rb +11 -0
- metadata +4 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40a72f524510c03062dc6c3dbf8a6a20236b1f25
|
4
|
+
data.tar.gz: 0378f2eeeb4ab372da04f9a2f1010d4847c85587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02c255084b29eccedf83860ece30471660af81abcf294cc332cd86816c963ff53e81d1fa4ed7f84108e33762775b08fbf124877452690dfe4755d23cb5788bf4
|
7
|
+
data.tar.gz: 6b5e34b3863e6cfe1311f4aed6706de099cc09371a2fb8a6439c6a5f164afa2511a18cf0086abded3541770561342c0d6a58ad4e96aaa6b5d7021e66054f1bbe
|
data/CHANGES.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
1.2.1 (2016-01-31)
|
2
|
+
------------------
|
3
|
+
* Fix bug in the JRuby backend which cases indefinite blocking when small
|
4
|
+
timeout values are passed to the selector
|
5
|
+
|
1
6
|
1.2.0 (2015-12-22)
|
2
7
|
------------------
|
3
8
|
* Add NIO::Monitor#interests= API for changing interests. Contributed by
|
4
|
-
|
9
|
+
Upekshe Jayasekera as a Google Summer of Code project.
|
5
10
|
* Update to libev 4.22
|
6
11
|
|
7
12
|
1.1.1 (2015-07-17)
|
data/Gemfile
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
+
gemspec
|
4
|
+
|
3
5
|
gem "jruby-openssl" if defined? JRUBY_VERSION
|
4
|
-
gem "coveralls", require: false
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
group :development do
|
8
|
+
gem "rake-compiler"
|
9
|
+
end
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem "rspec", "~> 3.0"
|
13
|
+
gem "rubocop", "0.36.0"
|
14
|
+
gem "coveralls", require: false
|
15
|
+
end
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
![nio4r](https://raw.github.com/celluloid/nio4r/master/logo.png)
|
2
2
|
===============
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/nio4r.
|
4
|
-
[![Build Status](https://secure.travis-ci.org/celluloid/nio4r.
|
5
|
-
[![Code Climate](https://codeclimate.com/github/celluloid/nio4r.
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/celluloid/nio4r/badge.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nio4r.svg)](http://rubygems.org/gems/nio4r)
|
4
|
+
[![Build Status](https://secure.travis-ci.org/celluloid/nio4r.svg?branch=master)](http://travis-ci.org/celluloid/nio4r)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/celluloid/nio4r.svg)](https://codeclimate.com/github/celluloid/nio4r)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/celluloid/nio4r/badge.svg?branch=master)](https://coveralls.io/r/celluloid/nio4r)
|
7
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/celluloid/nio4r/blob/master/LICENSE.txt)
|
7
8
|
|
8
9
|
nio4r: New IO for Ruby.
|
9
10
|
|
@@ -137,6 +138,7 @@ if you aren't concerned with thread safety, or you're within a #select
|
|
137
138
|
block:
|
138
139
|
|
139
140
|
- ***#interests***: what this monitor is interested in (:r, :w, or :rw)
|
141
|
+
- ***#interests=***: change the current interests for a monitor (to :r, :w, or :rw)
|
140
142
|
- ***#readiness***: what I/O operations the monitored object is ready for
|
141
143
|
- ***#readable?***: was the IO readable last time it was selected?
|
142
144
|
- ***#writable?***: was the IO writable last time it was selected?
|
@@ -187,8 +189,8 @@ however this is not the case today.
|
|
187
189
|
License
|
188
190
|
-------
|
189
191
|
|
190
|
-
Copyright (c) 2011-
|
192
|
+
Copyright (c) 2011-2016 Tony Arcieri. Distributed under the MIT License.
|
191
193
|
See LICENSE.txt for further details.
|
192
194
|
|
193
|
-
Includes libev 4.
|
195
|
+
Includes libev 4.22. Copyright (c) 2007-2015 Marc Alexander Lehmann.
|
194
196
|
Distributed under the BSD license. See ext/libev/LICENSE for details.
|
@@ -287,7 +287,12 @@ public class Nio4r implements Library {
|
|
287
287
|
} else if(t < 0) {
|
288
288
|
throw runtime.newArgumentError("time interval must be positive");
|
289
289
|
} else {
|
290
|
-
|
290
|
+
long timeoutMilliSeconds = (long)(t * 1000);
|
291
|
+
if(timeoutMilliSeconds == 0) {
|
292
|
+
result = this.selector.selectNow();
|
293
|
+
} else {
|
294
|
+
result = this.selector.select(timeoutMilliSeconds);
|
295
|
+
}
|
291
296
|
}
|
292
297
|
}
|
293
298
|
context.getThread().afterBlockingCall();
|
data/lib/nio.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "thread"
|
2
4
|
require "socket"
|
3
5
|
require "nio/version"
|
@@ -16,7 +18,7 @@ end
|
|
16
18
|
if ENV["NIO4R_PURE"] == "true" || (Gem.win_platform? && !defined?(JRUBY_VERSION))
|
17
19
|
require "nio/monitor"
|
18
20
|
require "nio/selector"
|
19
|
-
NIO::ENGINE = "ruby"
|
21
|
+
NIO::ENGINE = "ruby".freeze
|
20
22
|
else
|
21
23
|
require "nio4r_ext"
|
22
24
|
|
@@ -24,8 +26,8 @@ else
|
|
24
26
|
require "java"
|
25
27
|
require "jruby"
|
26
28
|
org.nio4r.Nio4r.new.load(JRuby.runtime, false)
|
27
|
-
NIO::ENGINE = "java"
|
29
|
+
NIO::ENGINE = "java".freeze
|
28
30
|
else
|
29
|
-
NIO::ENGINE = "libev"
|
31
|
+
NIO::ENGINE = "libev".freeze
|
30
32
|
end
|
31
33
|
end
|
data/lib/nio/monitor.rb
CHANGED
data/lib/nio/selector.rb
CHANGED
@@ -78,11 +78,7 @@ module NIO
|
|
78
78
|
|
79
79
|
ready_writers.each do |io|
|
80
80
|
monitor = @selectables[io]
|
81
|
-
|
82
|
-
monitor.readiness = :rw
|
83
|
-
else
|
84
|
-
monitor.readiness = :w
|
85
|
-
end
|
81
|
+
monitor.readiness = (monitor.readiness == :r) ? :rw : :w
|
86
82
|
selected_monitors << monitor
|
87
83
|
end
|
88
84
|
|
data/lib/nio/version.rb
CHANGED
data/nio4r.gemspec
CHANGED
@@ -23,8 +23,6 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.extensions = ["ext/nio4r/extconf.rb"]
|
24
24
|
end
|
25
25
|
|
26
|
-
gem.add_development_dependency "rake-compiler"
|
27
26
|
gem.add_development_dependency "rake"
|
28
|
-
gem.add_development_dependency "
|
29
|
-
gem.add_development_dependency "rubocop"
|
27
|
+
gem.add_development_dependency "bundler"
|
30
28
|
end
|
data/spec/nio/selector_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "timeout"
|
2
3
|
|
3
4
|
# Timeouts should be at least this precise (in seconds) to pass the tests
|
4
5
|
# Typical precision should be better than this, but if it's worse it will fail
|
@@ -115,6 +116,16 @@ RSpec.describe NIO::Selector do
|
|
115
116
|
end
|
116
117
|
|
117
118
|
context "select" do
|
119
|
+
it "does not block on super small precision intervals" do
|
120
|
+
wait_interval = 1e-4
|
121
|
+
|
122
|
+
expect do
|
123
|
+
Timeout.timeout(2) do
|
124
|
+
subject.select(wait_interval)
|
125
|
+
end
|
126
|
+
end.not_to raise_error
|
127
|
+
end
|
128
|
+
|
118
129
|
it "selects IO objects" do
|
119
130
|
writer << "ohai"
|
120
131
|
unready = IO.pipe.first
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nio4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake-compiler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,21 +25,7 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
28
|
+
name: bundler
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - ">="
|
@@ -145,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
117
|
version: '0'
|
146
118
|
requirements: []
|
147
119
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.5.1
|
149
121
|
signing_key:
|
150
122
|
specification_version: 4
|
151
123
|
summary: NIO provides a high performance selector API for monitoring IO objects
|