kgio 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/GIT-VERSION-GEN +1 -1
- data/ext/kgio/accept.c +2 -1
- data/ext/kgio/blocking_io_region.h +6 -0
- data/ext/kgio/connect.c +6 -3
- data/ext/kgio/extconf.rb +1 -0
- data/ext/kgio/poll.c +1 -1
- data/ext/kgio/read_write.c +2 -2
- metadata +7 -6
data/GIT-VERSION-GEN
CHANGED
data/ext/kgio/accept.c
CHANGED
@@ -69,6 +69,7 @@ static VALUE xaccept(void *ptr)
|
|
69
69
|
|
70
70
|
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
71
71
|
# include <time.h>
|
72
|
+
# include "blocking_io_region.h"
|
72
73
|
/*
|
73
74
|
* Try to use a (real) blocking accept() since that can prevent
|
74
75
|
* thundering herds under Linux:
|
@@ -82,7 +83,7 @@ static int thread_accept(struct accept_args *a, int force_nonblock)
|
|
82
83
|
{
|
83
84
|
if (force_nonblock)
|
84
85
|
set_nonblocking(a->fd);
|
85
|
-
return (int)
|
86
|
+
return (int)rb_thread_io_blocking_region(xaccept, a, a->fd);
|
86
87
|
}
|
87
88
|
|
88
89
|
static void set_blocking_or_block(int fd)
|
data/ext/kgio/connect.c
CHANGED
@@ -98,7 +98,8 @@ static VALUE tcp_connect(VALUE klass, VALUE ip, VALUE port, int io_wait)
|
|
98
98
|
* Creates a new Kgio::TCPSocket object and initiates a
|
99
99
|
* non-blocking connection.
|
100
100
|
*
|
101
|
-
* This may block and call any method defined to kgio_wait_writable
|
101
|
+
* This may block and call any method defined to +kgio_wait_writable+
|
102
|
+
* for the class.
|
102
103
|
*
|
103
104
|
* Unlike the TCPSocket.new in Ruby, this does NOT perform DNS
|
104
105
|
* lookups (which is subject to a different set of timeouts and
|
@@ -155,7 +156,8 @@ static VALUE unix_connect(VALUE klass, VALUE path, int io_wait)
|
|
155
156
|
* Creates a new Kgio::UNIXSocket object and initiates a
|
156
157
|
* non-blocking connection.
|
157
158
|
*
|
158
|
-
* This may block and call any method defined to kgio_wait_writable
|
159
|
+
* This may block and call any method defined to +kgio_wait_writable+
|
160
|
+
* for the class.
|
159
161
|
*/
|
160
162
|
static VALUE kgio_unix_connect(VALUE klass, VALUE path)
|
161
163
|
{
|
@@ -212,7 +214,8 @@ static VALUE stream_connect(VALUE klass, VALUE addr, int io_wait)
|
|
212
214
|
* Creates a generic Kgio::Socket object and initiates a
|
213
215
|
* non-blocking connection.
|
214
216
|
*
|
215
|
-
* This may block and call any method
|
217
|
+
* This may block and call any method defined to +kgio_wait_writable+
|
218
|
+
* for the class.
|
216
219
|
*/
|
217
220
|
static VALUE kgio_connect(VALUE klass, VALUE addr)
|
218
221
|
{
|
data/ext/kgio/extconf.rb
CHANGED
@@ -27,6 +27,7 @@ have_type("struct RObject") and check_sizeof("struct RObject")
|
|
27
27
|
check_sizeof("int")
|
28
28
|
have_func('rb_io_ascii8bit_binmode')
|
29
29
|
have_func('rb_thread_blocking_region')
|
30
|
+
have_func('rb_thread_io_blocking_region')
|
30
31
|
have_func('rb_str_set_len')
|
31
32
|
|
32
33
|
dir_config('kgio')
|
data/ext/kgio/poll.c
CHANGED
@@ -62,7 +62,7 @@ static int io_to_pollfd_i(VALUE key, VALUE value, VALUE args)
|
|
62
62
|
|
63
63
|
static void hash2pollfds(struct poll_args *a)
|
64
64
|
{
|
65
|
-
a->fds = xmalloc(sizeof(struct
|
65
|
+
a->fds = xmalloc(sizeof(struct pollfd) * RHASH_SIZE(a->ios));
|
66
66
|
a->fd_to_io = st_init_numtable();
|
67
67
|
rb_hash_foreach(a->ios, io_to_pollfd_i, (VALUE)a);
|
68
68
|
}
|
data/ext/kgio/read_write.c
CHANGED
@@ -126,7 +126,7 @@ retry:
|
|
126
126
|
* Reads at most maxlen bytes from the stream socket. Returns with a
|
127
127
|
* newly allocated buffer, or may reuse an existing buffer if supplied.
|
128
128
|
*
|
129
|
-
*
|
129
|
+
* This may block and call any method defined to +kgio_wait_readable+
|
130
130
|
* for the class.
|
131
131
|
*
|
132
132
|
* Returns nil on EOF.
|
@@ -359,7 +359,7 @@ retry:
|
|
359
359
|
*
|
360
360
|
* Returns nil when the write completes.
|
361
361
|
*
|
362
|
-
*
|
362
|
+
* This may block and call any method defined to +kgio_wait_writable+
|
363
363
|
* for the class.
|
364
364
|
*/
|
365
365
|
static VALUE kgio_write(VALUE io, VALUE str)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kgio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 5
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 3
|
10
|
+
version: 2.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kgio hackers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-15 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- ext/kgio/accept.c
|
97
97
|
- ext/kgio/ancient_ruby.h
|
98
98
|
- ext/kgio/autopush.c
|
99
|
+
- ext/kgio/blocking_io_region.h
|
99
100
|
- ext/kgio/connect.c
|
100
101
|
- ext/kgio/extconf.rb
|
101
102
|
- ext/kgio/kgio.h
|
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
requirements: []
|
169
170
|
|
170
171
|
rubyforge_project: rainbows
|
171
|
-
rubygems_version: 1.
|
172
|
+
rubygems_version: 1.6.1
|
172
173
|
signing_key:
|
173
174
|
specification_version: 3
|
174
175
|
summary: kinder, gentler I/O for Ruby
|