io-event 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/io/event/selector/epoll.c +21 -7
- data/lib/io/event/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df3b3dcc41afd982188c85b96e4d63056ae5edb43c41a5f650f8af9d2e6d5bf1
|
4
|
+
data.tar.gz: d3b1ca8e0241b85517940941507163c2c0a1faff442908521e0749b1848d5820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dcd4266b204828ed5514075ba2e00cdab0de2f20a63d8d37ee831493778b713e72ef51a97857fe1e3ec6761b1ba9f2a71bfb9e6b185249c18a1f6d9a3b28265
|
7
|
+
data.tar.gz: eaa160b9cb38c5564dad8b4b81971a6e8a30f27f409d8e547dff1514165eaced3d4954ea1db1ed33a4f22b2aeb82069aa7ad0755b84deb96d654a148904852b6
|
@@ -28,7 +28,9 @@
|
|
28
28
|
#include "pidfd.c"
|
29
29
|
#include "../interrupt.h"
|
30
30
|
|
31
|
-
|
31
|
+
enum {
|
32
|
+
DEBUG = 0,
|
33
|
+
};
|
32
34
|
|
33
35
|
static VALUE IO_Event_Selector_EPoll = Qnil;
|
34
36
|
|
@@ -325,26 +327,38 @@ VALUE IO_Event_Selector_EPoll_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE e
|
|
325
327
|
event.events = epoll_flags_from_events(NUM2INT(events));
|
326
328
|
event.data.ptr = (void*)fiber;
|
327
329
|
|
328
|
-
|
330
|
+
if (DEBUG) fprintf(stderr, "<- fiber=%p descriptor=%d\n", (void*)fiber, descriptor);
|
329
331
|
|
330
332
|
// A better approach is to batch all changes:
|
331
333
|
int result = epoll_ctl(data->descriptor, EPOLL_CTL_ADD, descriptor, &event);
|
332
334
|
|
333
335
|
if (result == -1 && errno == EEXIST) {
|
334
336
|
// The file descriptor was already inserted into epoll.
|
335
|
-
duplicate =
|
336
|
-
|
337
|
-
rb_update_max_fd(duplicate);
|
337
|
+
duplicate = dup(descriptor);
|
338
338
|
|
339
|
-
if (
|
339
|
+
if (duplicate == -1) {
|
340
340
|
rb_sys_fail("IO_Event_Selector_EPoll_io_wait:dup");
|
341
341
|
}
|
342
342
|
|
343
|
+
descriptor = duplicate;
|
344
|
+
|
345
|
+
rb_update_max_fd(descriptor);
|
346
|
+
|
343
347
|
result = epoll_ctl(data->descriptor, EPOLL_CTL_ADD, descriptor, &event);
|
344
348
|
}
|
345
349
|
|
346
350
|
if (result == -1) {
|
347
|
-
|
351
|
+
// If we duplicated the file descriptor, ensure it's closed:
|
352
|
+
if (duplicate >= 0) {
|
353
|
+
close(duplicate);
|
354
|
+
}
|
355
|
+
|
356
|
+
if (errno == EPERM) {
|
357
|
+
IO_Event_Selector_queue_push(&data->backend, fiber);
|
358
|
+
IO_Event_Selector_yield(&data->backend);
|
359
|
+
return events;
|
360
|
+
}
|
361
|
+
|
348
362
|
rb_sys_fail("IO_Event_Selector_EPoll_io_wait:epoll_ctl");
|
349
363
|
}
|
350
364
|
|
data/lib/io/event/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-03-
|
14
|
+
date: 2022-03-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bake
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.2.32
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: An event loop.
|