io-event 0.4.0 → 1.0.2
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.
- checksums.yaml +4 -4
- data/ext/IO_Event.bundle +0 -0
- data/ext/Makefile +24 -25
- data/ext/event.o +0 -0
- data/ext/extconf.h +0 -4
- data/ext/interrupt.o +0 -0
- data/ext/io/event/selector/epoll.c +15 -2
- data/ext/io/event/selector/kqueue.c +22 -9
- data/ext/io/event/selector/uring.c +26 -8
- data/ext/kqueue.o +0 -0
- data/ext/mkmf.log +45 -27
- data/ext/selector.o +0 -0
- data/lib/io/event/debug/selector.rb +4 -60
- data/lib/io/event/selector/select.rb +51 -23
- data/lib/io/event/selector.rb +11 -6
- data/lib/io/event/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 050c0a061c54668eaf5d41eab6d70644410a0e6469b7e68cd26a6fa7c4a50f8a
|
4
|
+
data.tar.gz: 22be34dad07b0f75fc68045ff17b92c29ffbebdc06e4f570d3f92758d8532192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92a187c8f2034aba8c33117fdc48a4055112cf1ea481a77d5fa7acc84683bedd04e295cb01e29c66ca2b23851debe8f86ec306d183c6c8474f5c44c2aef461da
|
7
|
+
data.tar.gz: 9e4da7190480b3d56556c440ebf922134e139b93cdd8c6ca5f8b7cea24c15bb8b943e6437b0c492d135f76dfaec32d63cc3ed43987545436c116d43e16ca5c4c
|
data/ext/IO_Event.bundle
CHANGED
Binary file
|
data/ext/Makefile
CHANGED
@@ -3,7 +3,6 @@ SHELL = /bin/sh
|
|
3
3
|
|
4
4
|
# V=0 quiet, V=1 verbose. other values don't work.
|
5
5
|
V = 0
|
6
|
-
V0 = $(V:0=)
|
7
6
|
Q1 = $(V:1=)
|
8
7
|
Q = $(Q1:0=@)
|
9
8
|
ECHO1 = $(V:1=@ :)
|
@@ -13,12 +12,12 @@ NULLCMD = :
|
|
13
12
|
#### Start of system configuration section. ####
|
14
13
|
|
15
14
|
srcdir = .
|
16
|
-
topdir = /Users/samuel/.rubies/ruby-
|
15
|
+
topdir = /Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0
|
17
16
|
hdrdir = $(topdir)
|
18
|
-
arch_hdrdir = /Users/samuel/.rubies/ruby-
|
17
|
+
arch_hdrdir = /Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21
|
19
18
|
PATH_SEPARATOR = :
|
20
19
|
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/io/event:$(srcdir)/io/event/selector
|
21
|
-
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-
|
20
|
+
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.0.3
|
22
21
|
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
23
22
|
rubyarchprefix = $(rubylibprefix)/$(arch)
|
24
23
|
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
@@ -51,8 +50,8 @@ dvidir = $(docdir)
|
|
51
50
|
htmldir = $(docdir)
|
52
51
|
infodir = $(datarootdir)/info
|
53
52
|
docdir = $(datarootdir)/doc/$(PACKAGE)
|
54
|
-
oldincludedir = $(
|
55
|
-
includedir = $(
|
53
|
+
oldincludedir = $(SDKROOT)/usr/include
|
54
|
+
includedir = $(prefix)/include
|
56
55
|
runstatedir = $(localstatedir)/run
|
57
56
|
localstatedir = $(prefix)/var
|
58
57
|
sharedstatedir = $(prefix)/com
|
@@ -66,33 +65,33 @@ archdir = $(rubyarchdir)
|
|
66
65
|
|
67
66
|
|
68
67
|
CC_WRAPPER =
|
69
|
-
CC = clang
|
70
|
-
CXX = clang++
|
68
|
+
CC = clang -fdeclspec
|
69
|
+
CXX = clang++ -fdeclspec
|
71
70
|
LIBRUBY = $(LIBRUBY_A)
|
72
71
|
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
73
72
|
LIBRUBYARG_SHARED =
|
74
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework
|
73
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
|
75
74
|
empty =
|
76
75
|
OUTFLAG = -o $(empty)
|
77
76
|
COUTFLAG = -o $(empty)
|
78
77
|
CSRCFLAG = $(empty)
|
79
78
|
|
80
79
|
RUBY_EXTCONF_H = extconf.h
|
81
|
-
cflags =
|
80
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
82
81
|
cxxflags =
|
83
|
-
optflags = -O3
|
82
|
+
optflags = -O3
|
84
83
|
debugflags = -ggdb3
|
85
|
-
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -
|
84
|
+
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens
|
86
85
|
cppflags =
|
87
86
|
CCDLFLAGS = -fno-common
|
88
|
-
CFLAGS = $(CCDLFLAGS) $(cflags)
|
87
|
+
CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall -std=c99 $(ARCH_FLAG)
|
89
88
|
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
90
89
|
DEFS =
|
91
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
92
|
-
CXXFLAGS = $(CCDLFLAGS)
|
93
|
-
ldflags = -L. -fstack-protector-strong
|
94
|
-
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
95
|
-
ARCH_FLAG =
|
90
|
+
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
91
|
+
CXXFLAGS = $(CCDLFLAGS) $(ARCH_FLAG)
|
92
|
+
ldflags = -L. -fstack-protector-strong -L/opt/local/lib
|
93
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/opt/local/lib
|
94
|
+
ARCH_FLAG = -m64
|
96
95
|
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
97
96
|
LDSHARED = $(CC) -dynamic -bundle
|
98
97
|
LDSHAREDXX = $(CXX) -dynamic -bundle
|
@@ -100,7 +99,7 @@ AR = ar
|
|
100
99
|
EXEEXT =
|
101
100
|
|
102
101
|
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
103
|
-
RUBY_SO_NAME = ruby.3.
|
102
|
+
RUBY_SO_NAME = ruby.3.0
|
104
103
|
RUBYW_INSTALL_NAME =
|
105
104
|
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
106
105
|
RUBYW_BASE_NAME = rubyw
|
@@ -108,13 +107,13 @@ RUBY_BASE_NAME = ruby
|
|
108
107
|
|
109
108
|
arch = arm64-darwin21
|
110
109
|
sitearch = $(arch)
|
111
|
-
ruby_version = 3.
|
110
|
+
ruby_version = 3.0.0
|
112
111
|
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
113
112
|
RUBY = $(ruby)
|
114
113
|
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
|
115
114
|
|
116
115
|
RM = rm -f
|
117
|
-
RM_RF = rm -
|
116
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
118
117
|
RMDIRS = rmdir -p
|
119
118
|
MAKEDIRS = /opt/local/bin/gmkdir -p
|
120
119
|
INSTALL = /opt/local/bin/ginstall -c
|
@@ -126,8 +125,8 @@ TOUCH = exit >
|
|
126
125
|
#### End of system configuration section. ####
|
127
126
|
|
128
127
|
preload =
|
129
|
-
libpath = . $(libdir)
|
130
|
-
LIBPATH = -L. -L$(libdir)
|
128
|
+
libpath = . $(libdir) /opt/local/lib
|
129
|
+
LIBPATH = -L. -L$(libdir) -L/opt/local/lib
|
131
130
|
DEFFILE =
|
132
131
|
|
133
132
|
CLEANFILES = mkmf.log
|
@@ -160,7 +159,7 @@ HDRDIR = $(sitehdrdir)$(target_prefix)
|
|
160
159
|
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
161
160
|
TARGET_SO_DIR =
|
162
161
|
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
163
|
-
CLEANLIBS = $(TARGET_SO)
|
162
|
+
CLEANLIBS = $(TARGET_SO)
|
164
163
|
CLEANOBJS = *.o *.bak
|
165
164
|
|
166
165
|
all: $(DLLIB)
|
@@ -173,7 +172,7 @@ clean-rb-default::
|
|
173
172
|
clean-rb::
|
174
173
|
clean-so::
|
175
174
|
clean: clean-so clean-static clean-rb-default clean-rb
|
176
|
-
-$(Q)$(
|
175
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
177
176
|
|
178
177
|
distclean-rb-default::
|
179
178
|
distclean-rb::
|
data/ext/event.o
CHANGED
Binary file
|
data/ext/extconf.h
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
#ifndef EXTCONF_H
|
2
2
|
#define EXTCONF_H
|
3
3
|
#define HAVE_RB_EXT_RACTOR_SAFE 1
|
4
|
-
#define HAVE__RB_FIBER_TRANSFER 1
|
5
4
|
#define HAVE_SYS_EVENT_H 1
|
6
|
-
#define HAVE_RB_IO_DESCRIPTOR 1
|
7
5
|
#define HAVE_RB_FIBER_CURRENT 1
|
8
|
-
#define HAVE__RB_FIBER_RAISE 1
|
9
|
-
#define HAVE_RUBY_IO_BUFFER_H 1
|
10
6
|
#endif
|
data/ext/interrupt.o
CHANGED
Binary file
|
@@ -299,6 +299,11 @@ VALUE io_wait_transfer(VALUE _arguments) {
|
|
299
299
|
|
300
300
|
VALUE result = IO_Event_Selector_fiber_transfer(arguments->data->backend.loop, 0, NULL);
|
301
301
|
|
302
|
+
// If the fiber is being cancelled, it might be resumed with nil:
|
303
|
+
if (!RTEST(result)) {
|
304
|
+
return Qfalse;
|
305
|
+
}
|
306
|
+
|
302
307
|
return INT2NUM(events_from_epoll_flags(NUM2INT(result)));
|
303
308
|
};
|
304
309
|
|
@@ -540,7 +545,11 @@ void select_internal_without_gvl(struct select_arguments *arguments) {
|
|
540
545
|
arguments->data->blocked = 0;
|
541
546
|
|
542
547
|
if (arguments->count == -1) {
|
543
|
-
|
548
|
+
if (errno != EINTR) {
|
549
|
+
rb_sys_fail("select_internal_without_gvl:epoll_wait");
|
550
|
+
} else {
|
551
|
+
arguments->count = 0;
|
552
|
+
}
|
544
553
|
}
|
545
554
|
}
|
546
555
|
|
@@ -549,7 +558,11 @@ void select_internal_with_gvl(struct select_arguments *arguments) {
|
|
549
558
|
select_internal((void *)arguments);
|
550
559
|
|
551
560
|
if (arguments->count == -1) {
|
552
|
-
|
561
|
+
if (errno != EINTR) {
|
562
|
+
rb_sys_fail("select_internal_with_gvl:epoll_wait");
|
563
|
+
} else {
|
564
|
+
arguments->count = 0;
|
565
|
+
}
|
553
566
|
}
|
554
567
|
}
|
555
568
|
|
@@ -190,7 +190,7 @@ int process_add_filters(int descriptor, int ident, VALUE fiber) {
|
|
190
190
|
|
191
191
|
event.ident = ident;
|
192
192
|
event.filter = EVFILT_PROC;
|
193
|
-
event.flags = EV_ADD | EV_ENABLE | EV_ONESHOT;
|
193
|
+
event.flags = EV_ADD | EV_ENABLE | EV_ONESHOT | EV_UDATA_SPECIFIC;
|
194
194
|
event.fflags = NOTE_EXIT;
|
195
195
|
event.udata = (void*)fiber;
|
196
196
|
|
@@ -214,7 +214,7 @@ void process_remove_filters(int descriptor, int ident) {
|
|
214
214
|
|
215
215
|
event.ident = ident;
|
216
216
|
event.filter = EVFILT_PROC;
|
217
|
-
event.flags = EV_DELETE;
|
217
|
+
event.flags = EV_DELETE | EV_UDATA_SPECIFIC;
|
218
218
|
event.fflags = NOTE_EXIT;
|
219
219
|
|
220
220
|
// Ignore the result.
|
@@ -273,7 +273,7 @@ int io_add_filters(int descriptor, int ident, int events, VALUE fiber) {
|
|
273
273
|
if (events & IO_EVENT_READABLE) {
|
274
274
|
kevents[count].ident = ident;
|
275
275
|
kevents[count].filter = EVFILT_READ;
|
276
|
-
kevents[count].flags = EV_ADD | EV_ENABLE | EV_ONESHOT;
|
276
|
+
kevents[count].flags = EV_ADD | EV_ENABLE | EV_ONESHOT | EV_UDATA_SPECIFIC;
|
277
277
|
kevents[count].udata = (void*)fiber;
|
278
278
|
|
279
279
|
// #ifdef EV_OOBAND
|
@@ -288,7 +288,7 @@ int io_add_filters(int descriptor, int ident, int events, VALUE fiber) {
|
|
288
288
|
if (events & IO_EVENT_WRITABLE) {
|
289
289
|
kevents[count].ident = ident;
|
290
290
|
kevents[count].filter = EVFILT_WRITE;
|
291
|
-
kevents[count].flags = EV_ADD | EV_ENABLE | EV_ONESHOT;
|
291
|
+
kevents[count].flags = EV_ADD | EV_ENABLE | EV_ONESHOT | EV_UDATA_SPECIFIC;
|
292
292
|
kevents[count].udata = (void*)fiber;
|
293
293
|
count++;
|
294
294
|
}
|
@@ -310,7 +310,7 @@ void io_remove_filters(int descriptor, int ident, int events) {
|
|
310
310
|
if (events & IO_EVENT_READABLE) {
|
311
311
|
kevents[count].ident = ident;
|
312
312
|
kevents[count].filter = EVFILT_READ;
|
313
|
-
kevents[count].flags = EV_DELETE;
|
313
|
+
kevents[count].flags = EV_DELETE | EV_UDATA_SPECIFIC;
|
314
314
|
|
315
315
|
count++;
|
316
316
|
}
|
@@ -318,7 +318,7 @@ void io_remove_filters(int descriptor, int ident, int events) {
|
|
318
318
|
if (events & IO_EVENT_WRITABLE) {
|
319
319
|
kevents[count].ident = ident;
|
320
320
|
kevents[count].filter = EVFILT_WRITE;
|
321
|
-
kevents[count].flags = EV_DELETE;
|
321
|
+
kevents[count].flags = EV_DELETE | EV_UDATA_SPECIFIC;
|
322
322
|
count++;
|
323
323
|
}
|
324
324
|
|
@@ -355,6 +355,11 @@ VALUE io_wait_transfer(VALUE _arguments) {
|
|
355
355
|
|
356
356
|
VALUE result = IO_Event_Selector_fiber_transfer(arguments->data->backend.loop, 0, NULL);
|
357
357
|
|
358
|
+
// If the fiber is being cancelled, it might be resumed with nil:
|
359
|
+
if (!RTEST(result)) {
|
360
|
+
return Qfalse;
|
361
|
+
}
|
362
|
+
|
358
363
|
return INT2NUM(events_from_kqueue_filter(RB_NUM2INT(result)));
|
359
364
|
}
|
360
365
|
|
@@ -605,7 +610,11 @@ void select_internal_without_gvl(struct select_arguments *arguments) {
|
|
605
610
|
arguments->data->blocked = 0;
|
606
611
|
|
607
612
|
if (arguments->count == -1) {
|
608
|
-
|
613
|
+
if (errno != EINTR) {
|
614
|
+
rb_sys_fail("select_internal_without_gvl:kevent");
|
615
|
+
} else {
|
616
|
+
arguments->count = 0;
|
617
|
+
}
|
609
618
|
}
|
610
619
|
}
|
611
620
|
|
@@ -614,7 +623,11 @@ void select_internal_with_gvl(struct select_arguments *arguments) {
|
|
614
623
|
select_internal((void *)arguments);
|
615
624
|
|
616
625
|
if (arguments->count == -1) {
|
617
|
-
|
626
|
+
if (errno != EINTR) {
|
627
|
+
rb_sys_fail("select_internal_with_gvl:kevent");
|
628
|
+
} else {
|
629
|
+
arguments->count = 0;
|
630
|
+
}
|
618
631
|
}
|
619
632
|
}
|
620
633
|
|
@@ -682,7 +695,7 @@ VALUE IO_Event_Selector_KQueue_wakeup(VALUE self) {
|
|
682
695
|
struct kevent trigger = {0};
|
683
696
|
|
684
697
|
trigger.filter = EVFILT_USER;
|
685
|
-
trigger.flags = EV_ADD|EV_CLEAR;
|
698
|
+
trigger.flags = EV_ADD | EV_CLEAR | EV_UDATA_SPECIFIC;
|
686
699
|
trigger.fflags = NOTE_TRIGGER;
|
687
700
|
|
688
701
|
int result = kevent(data->descriptor, &trigger, 1, NULL, 0, NULL);
|
@@ -27,6 +27,8 @@
|
|
27
27
|
|
28
28
|
#include "pidfd.c"
|
29
29
|
|
30
|
+
#include <linux/version.h>
|
31
|
+
|
30
32
|
enum {
|
31
33
|
DEBUG = 0,
|
32
34
|
DEBUG_IO_READ = 0,
|
@@ -336,6 +338,10 @@ VALUE io_wait_transfer(VALUE _arguments) {
|
|
336
338
|
VALUE result = IO_Event_Selector_fiber_transfer(data->backend.loop, 0, NULL);
|
337
339
|
if (DEBUG) fprintf(stderr, "io_wait:IO_Event_Selector_fiber_transfer -> %d\n", RB_NUM2INT(result));
|
338
340
|
|
341
|
+
if (!RTEST(result)) {
|
342
|
+
return Qfalse;
|
343
|
+
}
|
344
|
+
|
339
345
|
// We explicitly filter the resulting events based on the requested events.
|
340
346
|
// In some cases, poll will report events we didn't ask for.
|
341
347
|
short flags = arguments->flags & NUM2INT(result);
|
@@ -371,12 +377,28 @@ VALUE IO_Event_Selector_URing_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE e
|
|
371
377
|
|
372
378
|
#ifdef HAVE_RUBY_IO_BUFFER_H
|
373
379
|
|
380
|
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
381
|
+
static inline off_t io_seekable(int descriptor) {
|
382
|
+
return -1;
|
383
|
+
}
|
384
|
+
#else
|
385
|
+
#warning Upgrade your kernel to 5.16! io_uring bugs prevent efficient io_read/io_write hooks.
|
386
|
+
static inline off_t io_seekable(int descriptor)
|
387
|
+
{
|
388
|
+
if (lseek(descriptor, 0, SEEK_CUR) == -1) {
|
389
|
+
return 0;
|
390
|
+
} else {
|
391
|
+
return -1;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
#endif
|
395
|
+
|
374
396
|
static int io_read(struct IO_Event_Selector_URing *data, VALUE fiber, int descriptor, char *buffer, size_t length) {
|
375
397
|
struct io_uring_sqe *sqe = io_get_sqe(data);
|
376
398
|
|
377
399
|
if (DEBUG) fprintf(stderr, "io_read:io_uring_prep_read(fiber=%p)\n", (void*)fiber);
|
378
400
|
|
379
|
-
io_uring_prep_read(sqe, descriptor, buffer, length,
|
401
|
+
io_uring_prep_read(sqe, descriptor, buffer, length, io_seekable(descriptor));
|
380
402
|
io_uring_sqe_set_data(sqe, (void*)fiber);
|
381
403
|
io_uring_submit_now(data);
|
382
404
|
|
@@ -427,7 +449,7 @@ int io_write(struct IO_Event_Selector_URing *data, VALUE fiber, int descriptor,
|
|
427
449
|
|
428
450
|
if (DEBUG) fprintf(stderr, "io_write:io_uring_prep_write(fiber=%p)\n", (void*)fiber);
|
429
451
|
|
430
|
-
io_uring_prep_write(sqe, descriptor, buffer, length,
|
452
|
+
io_uring_prep_write(sqe, descriptor, buffer, length, io_seekable(descriptor));
|
431
453
|
io_uring_sqe_set_data(sqe, (void*)fiber);
|
432
454
|
io_uring_submit_pending(data);
|
433
455
|
|
@@ -558,6 +580,8 @@ int select_internal_without_gvl(struct select_arguments *arguments) {
|
|
558
580
|
|
559
581
|
if (arguments->result == -ETIME) {
|
560
582
|
arguments->result = 0;
|
583
|
+
} else if (arguments->result == -EINTR) {
|
584
|
+
arguments->result = 0;
|
561
585
|
} else if (arguments->result < 0) {
|
562
586
|
rb_syserr_fail(-arguments->result, "select_internal_without_gvl:io_uring_wait_cqe_timeout");
|
563
587
|
} else {
|
@@ -568,8 +592,6 @@ int select_internal_without_gvl(struct select_arguments *arguments) {
|
|
568
592
|
return arguments->result;
|
569
593
|
}
|
570
594
|
|
571
|
-
// #define IO_EVENT_SELECTOR_URING_UDATA_INTERRUPT ((__u64) -2)
|
572
|
-
|
573
595
|
static inline
|
574
596
|
unsigned select_process_completions(struct io_uring *ring) {
|
575
597
|
unsigned completed = 0;
|
@@ -585,10 +607,6 @@ unsigned select_process_completions(struct io_uring *ring) {
|
|
585
607
|
continue;
|
586
608
|
}
|
587
609
|
|
588
|
-
// if (cqe->user_data == IO_EVENT_SELECTOR_URING_UDATA_INTERRUPT) {
|
589
|
-
// io_uring_cq_advance(ring, 1);
|
590
|
-
// }
|
591
|
-
|
592
610
|
VALUE fiber = (VALUE)cqe->user_data;
|
593
611
|
VALUE result = RB_INT2NUM(cqe->res);
|
594
612
|
|
data/ext/kqueue.o
CHANGED
Binary file
|
data/ext/mkmf.log
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
have_func: checking for rb_ext_ractor_safe()... -------------------- yes
|
2
2
|
|
3
|
-
|
3
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
4
4
|
checked program was:
|
5
5
|
/* begin */
|
6
6
|
1: #include "ruby.h"
|
@@ -11,7 +11,7 @@ checked program was:
|
|
11
11
|
6: }
|
12
12
|
/* end */
|
13
13
|
|
14
|
-
|
14
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
15
15
|
checked program was:
|
16
16
|
/* begin */
|
17
17
|
1: #include "ruby.h"
|
@@ -32,9 +32,13 @@ checked program was:
|
|
32
32
|
|
33
33
|
--------------------
|
34
34
|
|
35
|
-
have_func: checking for &rb_fiber_transfer()... --------------------
|
35
|
+
have_func: checking for &rb_fiber_transfer()... -------------------- no
|
36
36
|
|
37
|
-
|
37
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
38
|
+
conftest.c:14:76: error: use of undeclared identifier 'rb_fiber_transfer'
|
39
|
+
int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; }
|
40
|
+
^
|
41
|
+
1 error generated.
|
38
42
|
checked program was:
|
39
43
|
/* begin */
|
40
44
|
1: #include "ruby.h"
|
@@ -57,7 +61,7 @@ checked program was:
|
|
57
61
|
|
58
62
|
have_library: checking for -luring... -------------------- no
|
59
63
|
|
60
|
-
|
64
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc -luring "
|
61
65
|
ld: library not found for -luring
|
62
66
|
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
63
67
|
checked program was:
|
@@ -83,7 +87,7 @@ checked program was:
|
|
83
87
|
|
84
88
|
have_header: checking for sys/epoll.h... -------------------- no
|
85
89
|
|
86
|
-
|
90
|
+
"clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -o conftest.i"
|
87
91
|
conftest.c:3:10: fatal error: 'sys/epoll.h' file not found
|
88
92
|
#include <sys/epoll.h>
|
89
93
|
^~~~~~~~~~~~~
|
@@ -99,7 +103,7 @@ checked program was:
|
|
99
103
|
|
100
104
|
have_header: checking for sys/event.h... -------------------- yes
|
101
105
|
|
102
|
-
|
106
|
+
"clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -o conftest.i"
|
103
107
|
checked program was:
|
104
108
|
/* begin */
|
105
109
|
1: #include "ruby.h"
|
@@ -111,7 +115,7 @@ checked program was:
|
|
111
115
|
|
112
116
|
have_header: checking for sys/eventfd.h... -------------------- no
|
113
117
|
|
114
|
-
|
118
|
+
"clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -o conftest.i"
|
115
119
|
conftest.c:3:10: fatal error: 'sys/eventfd.h' file not found
|
116
120
|
#include <sys/eventfd.h>
|
117
121
|
^~~~~~~~~~~~~~~
|
@@ -125,9 +129,9 @@ checked program was:
|
|
125
129
|
|
126
130
|
--------------------
|
127
131
|
|
128
|
-
have_func: checking for rb_io_descriptor()... --------------------
|
132
|
+
have_func: checking for rb_io_descriptor()... -------------------- no
|
129
133
|
|
130
|
-
|
134
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
131
135
|
conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
|
132
136
|
int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
|
133
137
|
^
|
@@ -150,7 +154,12 @@ checked program was:
|
|
150
154
|
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
|
151
155
|
/* end */
|
152
156
|
|
153
|
-
|
157
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
158
|
+
Undefined symbols for architecture arm64:
|
159
|
+
"_rb_io_descriptor", referenced from:
|
160
|
+
_t in conftest-d90377.o
|
161
|
+
ld: symbol(s) not found for architecture arm64
|
162
|
+
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
154
163
|
checked program was:
|
155
164
|
/* begin */
|
156
165
|
1: #include "ruby.h"
|
@@ -174,7 +183,7 @@ checked program was:
|
|
174
183
|
|
175
184
|
have_func: checking for &rb_process_status_wait()... -------------------- no
|
176
185
|
|
177
|
-
|
186
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
178
187
|
conftest.c:14:76: error: use of undeclared identifier 'rb_process_status_wait'
|
179
188
|
int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
|
180
189
|
^
|
@@ -201,7 +210,7 @@ checked program was:
|
|
201
210
|
|
202
211
|
have_func: checking for rb_fiber_current()... -------------------- yes
|
203
212
|
|
204
|
-
|
213
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
205
214
|
checked program was:
|
206
215
|
/* begin */
|
207
216
|
1: #include "ruby.h"
|
@@ -222,9 +231,17 @@ checked program was:
|
|
222
231
|
|
223
232
|
--------------------
|
224
233
|
|
225
|
-
have_func: checking for &rb_fiber_raise()... --------------------
|
234
|
+
have_func: checking for &rb_fiber_raise()... -------------------- no
|
226
235
|
|
227
|
-
|
236
|
+
"clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
|
237
|
+
conftest.c:14:76: error: use of undeclared identifier 'rb_fiber_raise'; did you mean 'rb_fiber_resume'?
|
238
|
+
int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
|
239
|
+
^~~~~~~~~~~~~~
|
240
|
+
rb_fiber_resume
|
241
|
+
/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/internal/intern/cont.h:32:7: note: 'rb_fiber_resume' declared here
|
242
|
+
VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
|
243
|
+
^
|
244
|
+
1 error generated.
|
228
245
|
checked program was:
|
229
246
|
/* begin */
|
230
247
|
1: #include "ruby.h"
|
@@ -245,9 +262,14 @@ checked program was:
|
|
245
262
|
|
246
263
|
--------------------
|
247
264
|
|
248
|
-
have_header: checking for ruby/io/buffer.h... --------------------
|
265
|
+
have_header: checking for ruby/io/buffer.h... -------------------- no
|
249
266
|
|
250
|
-
|
267
|
+
"clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall -std=c99 conftest.c -o conftest.i"
|
268
|
+
conftest.c:3:10: fatal error: 'ruby/io/buffer.h' file not found
|
269
|
+
#include <ruby/io/buffer.h>
|
270
|
+
^~~~~~~~~~~~~~~~~~
|
271
|
+
conftest.c:3:10: note: did not find header 'io/buffer.h' in framework 'ruby' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
|
272
|
+
1 error generated.
|
251
273
|
checked program was:
|
252
274
|
/* begin */
|
253
275
|
1: #include "ruby.h"
|
@@ -259,15 +281,11 @@ checked program was:
|
|
259
281
|
|
260
282
|
extconf.h is:
|
261
283
|
/* begin */
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
7: #define HAVE_RB_FIBER_CURRENT 1
|
269
|
-
8: #define HAVE__RB_FIBER_RAISE 1
|
270
|
-
9: #define HAVE_RUBY_IO_BUFFER_H 1
|
271
|
-
10: #endif
|
284
|
+
1: #ifndef EXTCONF_H
|
285
|
+
2: #define EXTCONF_H
|
286
|
+
3: #define HAVE_RB_EXT_RACTOR_SAFE 1
|
287
|
+
4: #define HAVE_SYS_EVENT_H 1
|
288
|
+
5: #define HAVE_RB_FIBER_CURRENT 1
|
289
|
+
6: #endif
|
272
290
|
/* end */
|
273
291
|
|
data/ext/selector.o
CHANGED
Binary file
|
@@ -30,7 +30,7 @@ module IO::Event
|
|
30
30
|
@priority = {}
|
31
31
|
|
32
32
|
unless Fiber.current == selector.loop
|
33
|
-
raise "Selector must be initialized on event loop fiber!"
|
33
|
+
Kernel::raise "Selector must be initialized on event loop fiber!"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ module IO::Event
|
|
40
40
|
|
41
41
|
def close
|
42
42
|
if @selector.nil?
|
43
|
-
raise "Selector already closed!"
|
43
|
+
Kernel::raise "Selector already closed!"
|
44
44
|
end
|
45
45
|
|
46
46
|
@selector.close
|
@@ -80,7 +80,7 @@ module IO::Event
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def io_wait(fiber, io, events)
|
83
|
-
|
83
|
+
@selector.io_wait(fiber, io, events)
|
84
84
|
end
|
85
85
|
|
86
86
|
if IO.const_defined?(:Buffer)
|
@@ -95,67 +95,11 @@ module IO::Event
|
|
95
95
|
|
96
96
|
def select(duration = nil)
|
97
97
|
unless Fiber.current == @selector.loop
|
98
|
-
raise "Selector must be run on event loop fiber!"
|
98
|
+
Kernel::raise "Selector must be run on event loop fiber!"
|
99
99
|
end
|
100
100
|
|
101
101
|
@selector.select(duration)
|
102
102
|
end
|
103
|
-
|
104
|
-
private
|
105
|
-
|
106
|
-
def register_readable(fiber, io, events)
|
107
|
-
if (events & IO::READABLE) > 0
|
108
|
-
if @readable.key?(io)
|
109
|
-
raise "Cannot wait for #{io} to become readable from multiple fibers."
|
110
|
-
end
|
111
|
-
|
112
|
-
begin
|
113
|
-
@readable[io] = fiber
|
114
|
-
|
115
|
-
register_writable(fiber, io, events)
|
116
|
-
ensure
|
117
|
-
@readable.delete(io)
|
118
|
-
end
|
119
|
-
else
|
120
|
-
register_writable(fiber, io, events)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def register_writable(fiber, io, events)
|
125
|
-
if (events & IO::WRITABLE) > 0
|
126
|
-
if @writable.key?(io)
|
127
|
-
raise "Cannot wait for #{io} to become writable from multiple fibers."
|
128
|
-
end
|
129
|
-
|
130
|
-
begin
|
131
|
-
@writable[io] = fiber
|
132
|
-
|
133
|
-
register_priority(fiber, io, events)
|
134
|
-
ensure
|
135
|
-
@writable.delete(io)
|
136
|
-
end
|
137
|
-
else
|
138
|
-
register_priority(fiber, io, events)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def register_priority(fiber, io, events)
|
143
|
-
if (events & IO::PRIORITY) > 0
|
144
|
-
if @priority.key?(io)
|
145
|
-
raise "Cannot wait for #{io} to become priority from multiple fibers."
|
146
|
-
end
|
147
|
-
|
148
|
-
begin
|
149
|
-
@priority[io] = fiber
|
150
|
-
|
151
|
-
@selector.io_wait(fiber, io, events)
|
152
|
-
ensure
|
153
|
-
@priority.delete(io)
|
154
|
-
end
|
155
|
-
else
|
156
|
-
@selector.io_wait(fiber, io, events)
|
157
|
-
end
|
158
|
-
end
|
159
103
|
end
|
160
104
|
end
|
161
105
|
end
|
@@ -26,8 +26,7 @@ module IO::Event
|
|
26
26
|
def initialize(loop)
|
27
27
|
@loop = loop
|
28
28
|
|
29
|
-
@
|
30
|
-
@writable = Hash.new.compare_by_identity
|
29
|
+
@waiting = Hash.new.compare_by_identity
|
31
30
|
|
32
31
|
@blocked = false
|
33
32
|
|
@@ -52,8 +51,7 @@ module IO::Event
|
|
52
51
|
@interrupt.close
|
53
52
|
|
54
53
|
@loop = nil
|
55
|
-
@
|
56
|
-
@writable = nil
|
54
|
+
@waiting = nil
|
57
55
|
end
|
58
56
|
|
59
57
|
Optional = Struct.new(:fiber) do
|
@@ -114,23 +112,40 @@ module IO::Event
|
|
114
112
|
!@ready.empty?
|
115
113
|
end
|
116
114
|
|
117
|
-
|
118
|
-
|
115
|
+
Waiter = Struct.new(:fiber, :events, :tail) do
|
116
|
+
def alive?
|
117
|
+
self.fiber&.alive?
|
118
|
+
end
|
119
|
+
|
120
|
+
def transfer(events)
|
121
|
+
if fiber = self.fiber
|
122
|
+
self.fiber = nil
|
123
|
+
|
124
|
+
fiber.transfer(events & self.events) if fiber.alive?
|
125
|
+
end
|
119
126
|
|
120
|
-
|
121
|
-
@readable[io] = fiber
|
122
|
-
remove_readable = true
|
127
|
+
self.tail&.transfer(events)
|
123
128
|
end
|
124
129
|
|
125
|
-
|
126
|
-
|
127
|
-
|
130
|
+
def invalidate
|
131
|
+
self.fiber = nil
|
132
|
+
end
|
133
|
+
|
134
|
+
def each(&block)
|
135
|
+
if fiber = self.fiber
|
136
|
+
yield fiber, self.events
|
137
|
+
end
|
138
|
+
|
139
|
+
self.tail&.each(&block)
|
128
140
|
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def io_wait(fiber, io, events)
|
144
|
+
waiter = @waiting[io] = Waiter.new(fiber, events, @waiting[io])
|
129
145
|
|
130
146
|
@loop.transfer
|
131
147
|
ensure
|
132
|
-
|
133
|
-
@writable.delete(io) if remove_writable
|
148
|
+
waiter&.invalidate
|
134
149
|
end
|
135
150
|
|
136
151
|
if IO.const_defined?(:Buffer)
|
@@ -155,9 +170,9 @@ module IO::Event
|
|
155
170
|
else
|
156
171
|
return -EAGAIN
|
157
172
|
end
|
173
|
+
when nil
|
174
|
+
break
|
158
175
|
else
|
159
|
-
break unless result
|
160
|
-
|
161
176
|
buffer.set_string(result, offset)
|
162
177
|
|
163
178
|
size = result.bytesize
|
@@ -238,25 +253,38 @@ module IO::Event
|
|
238
253
|
duration = 0
|
239
254
|
end
|
240
255
|
|
256
|
+
readable = Array.new
|
257
|
+
writable = Array.new
|
258
|
+
|
259
|
+
@waiting.each do |io, waiter|
|
260
|
+
waiter.each do |fiber, events|
|
261
|
+
if (events & IO::READABLE) > 0
|
262
|
+
readable << io
|
263
|
+
end
|
264
|
+
|
265
|
+
if (events & IO::WRITABLE) > 0
|
266
|
+
writable << io
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
241
271
|
@blocked = true
|
242
272
|
duration = 0 unless @ready.empty?
|
243
|
-
readable, writable, _ = ::IO.select(
|
273
|
+
readable, writable, _ = ::IO.select(readable, writable, nil, duration)
|
244
274
|
@blocked = false
|
245
275
|
|
246
276
|
ready = Hash.new(0)
|
247
277
|
|
248
278
|
readable&.each do |io|
|
249
|
-
|
250
|
-
ready[fiber] |= IO::READABLE
|
279
|
+
ready[io] |= IO::READABLE
|
251
280
|
end
|
252
281
|
|
253
282
|
writable&.each do |io|
|
254
|
-
|
255
|
-
ready[fiber] |= IO::WRITABLE
|
283
|
+
ready[io] |= IO::WRITABLE
|
256
284
|
end
|
257
285
|
|
258
|
-
ready.each do |
|
259
|
-
|
286
|
+
ready.each do |io, events|
|
287
|
+
@waiting.delete(io).transfer(events)
|
260
288
|
end
|
261
289
|
|
262
290
|
return ready.size
|
data/lib/io/event/selector.rb
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
require_relative 'selector/select'
|
22
|
+
require_relative 'debug/selector'
|
22
23
|
|
23
24
|
module IO::Event
|
24
25
|
module Selector
|
@@ -31,19 +32,23 @@ module IO::Event
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
|
-
if self.const_defined?(:
|
35
|
-
return
|
35
|
+
if self.const_defined?(:EPoll)
|
36
|
+
return EPoll
|
36
37
|
elsif self.const_defined?(:KQueue)
|
37
38
|
return KQueue
|
38
|
-
elsif self.const_defined?(:EPoll)
|
39
|
-
return EPoll
|
40
39
|
else
|
41
40
|
return Select
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
def self.new(loop)
|
46
|
-
default.new(loop)
|
44
|
+
def self.new(loop, env = ENV)
|
45
|
+
selector = default(env).new(loop)
|
46
|
+
|
47
|
+
if debug = env['IO_EVENT_DEBUG_SELECTOR']
|
48
|
+
selector = Debug::Selector.new(selector)
|
49
|
+
end
|
50
|
+
|
51
|
+
return selector
|
47
52
|
end
|
48
53
|
end
|
49
54
|
end
|
data/lib/io/event/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bake
|
@@ -113,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
116
|
+
version: '3.0'
|
117
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.2.32
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: An event loop.
|