io-event 1.0.1 → 1.0.2
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.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/kqueue.c +7 -7
- 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 +9 -2
- 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: 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
|
@@ -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
|
|
@@ -695,7 +695,7 @@ VALUE IO_Event_Selector_KQueue_wakeup(VALUE self) {
|
|
695
695
|
struct kevent trigger = {0};
|
696
696
|
|
697
697
|
trigger.filter = EVFILT_USER;
|
698
|
-
trigger.flags = EV_ADD|EV_CLEAR;
|
698
|
+
trigger.flags = EV_ADD | EV_CLEAR | EV_UDATA_SPECIFIC;
|
699
699
|
trigger.fflags = NOTE_TRIGGER;
|
700
700
|
|
701
701
|
int result = kevent(data->descriptor, &trigger, 1, NULL, 0, NULL);
|
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
|
@@ -40,8 +41,14 @@ module IO::Event
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
def self.new(loop)
|
44
|
-
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
|
45
52
|
end
|
46
53
|
end
|
47
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: 1.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
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
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.
|