io-event 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/IO_Event.bundle +0 -0
- data/ext/Makefile +267 -0
- data/ext/event.o +0 -0
- data/ext/extconf.h +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/io/event/event.c +52 -0
- data/ext/io/event/event.h +39 -0
- data/ext/io/event/selector/epoll.c +577 -0
- data/ext/io/event/selector/epoll.h +25 -0
- data/ext/io/event/selector/kqueue.c +652 -0
- data/ext/io/event/selector/kqueue.h +27 -0
- data/ext/io/event/selector/pidfd.c +36 -0
- data/ext/io/event/selector/selector.c +294 -0
- data/ext/io/event/selector/selector.h +123 -0
- data/ext/io/event/selector/uring.c +644 -0
- data/ext/io/event/selector/uring.h +28 -0
- data/ext/kqueue.o +0 -0
- data/ext/mkmf.log +275 -0
- data/ext/selector.o +0 -0
- data/lib/io/event/debug/selector.rb +149 -0
- data/lib/io/event/selector/select.rb +219 -0
- data/lib/io/event/selector.rb +54 -0
- data/lib/io/event/version.rb +23 -0
- data/lib/io/event.rb +29 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d311214a03ab6047c7ba6952dfeeef690a453d0bd661df5e5419f477832b3cbd
|
4
|
+
data.tar.gz: 51653482b73275b35b8ac590b5576d2d991170c463d540fd3e5b6dbd8c2d4555
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e9f333103f29c2e2a69f1573fefb11c01a23d2cf9cc56e30343e9e9f9ec6f5bd5f44408a95cbdd84bf9350b7eb7e3d2ea57df92702a97407e49ab7a6006b9506
|
7
|
+
data.tar.gz: a35949d9fb40a0361b2627f3d998dfae230474a9fcb51f6361c0d3686560cc3d22749147e9a581dfc8f429ffd35b80d920a780400d66398e4de9c113d4122f8e
|
data/ext/IO_Event.bundle
ADDED
Binary file
|
data/ext/Makefile
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@ :)
|
9
|
+
ECHO = $(ECHO1:0=@ echo)
|
10
|
+
NULLCMD = :
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = .
|
15
|
+
topdir = /Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0
|
16
|
+
hdrdir = $(topdir)
|
17
|
+
arch_hdrdir = /Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21
|
18
|
+
PATH_SEPARATOR = :
|
19
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/io/event:$(srcdir)/io/event/selector
|
20
|
+
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.0.3
|
21
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
+
exec_prefix = $(prefix)
|
25
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
+
sitedir = $(rubylibprefix)/site_ruby
|
37
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
+
archincludedir = $(includedir)/$(arch)
|
41
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
+
archlibdir = $(libdir)/$(arch)
|
43
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
+
mandir = $(datarootdir)/man
|
45
|
+
localedir = $(datarootdir)/locale
|
46
|
+
libdir = $(exec_prefix)/lib
|
47
|
+
psdir = $(docdir)
|
48
|
+
pdfdir = $(docdir)
|
49
|
+
dvidir = $(docdir)
|
50
|
+
htmldir = $(docdir)
|
51
|
+
infodir = $(datarootdir)/info
|
52
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
+
oldincludedir = $(SDKROOT)/usr/include
|
54
|
+
includedir = $(prefix)/include
|
55
|
+
runstatedir = $(localstatedir)/run
|
56
|
+
localstatedir = $(prefix)/var
|
57
|
+
sharedstatedir = $(prefix)/com
|
58
|
+
sysconfdir = $(prefix)/etc
|
59
|
+
datadir = $(datarootdir)
|
60
|
+
datarootdir = $(prefix)/share
|
61
|
+
libexecdir = $(exec_prefix)/libexec
|
62
|
+
sbindir = $(exec_prefix)/sbin
|
63
|
+
bindir = $(exec_prefix)/bin
|
64
|
+
archdir = $(rubyarchdir)
|
65
|
+
|
66
|
+
|
67
|
+
CC_WRAPPER =
|
68
|
+
CC = clang -fdeclspec
|
69
|
+
CXX = clang++ -fdeclspec
|
70
|
+
LIBRUBY = $(LIBRUBY_A)
|
71
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
72
|
+
LIBRUBYARG_SHARED =
|
73
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
|
74
|
+
empty =
|
75
|
+
OUTFLAG = -o $(empty)
|
76
|
+
COUTFLAG = -o $(empty)
|
77
|
+
CSRCFLAG = $(empty)
|
78
|
+
|
79
|
+
RUBY_EXTCONF_H = extconf.h
|
80
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
81
|
+
cxxflags =
|
82
|
+
optflags = -O3
|
83
|
+
debugflags = -ggdb3
|
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
|
85
|
+
cppflags =
|
86
|
+
CCDLFLAGS = -fno-common
|
87
|
+
CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall $(ARCH_FLAG)
|
88
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
89
|
+
DEFS =
|
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
|
95
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
96
|
+
LDSHARED = $(CC) -dynamic -bundle
|
97
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
98
|
+
AR = ar
|
99
|
+
EXEEXT =
|
100
|
+
|
101
|
+
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
102
|
+
RUBY_SO_NAME = ruby.3.0
|
103
|
+
RUBYW_INSTALL_NAME =
|
104
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
105
|
+
RUBYW_BASE_NAME = rubyw
|
106
|
+
RUBY_BASE_NAME = ruby
|
107
|
+
|
108
|
+
arch = arm64-darwin21
|
109
|
+
sitearch = $(arch)
|
110
|
+
ruby_version = 3.0.0
|
111
|
+
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
112
|
+
RUBY = $(ruby)
|
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)
|
114
|
+
|
115
|
+
RM = rm -f
|
116
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
117
|
+
RMDIRS = rmdir -p
|
118
|
+
MAKEDIRS = /opt/local/bin/gmkdir -p
|
119
|
+
INSTALL = /opt/local/bin/ginstall -c
|
120
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
121
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
122
|
+
COPY = cp
|
123
|
+
TOUCH = exit >
|
124
|
+
|
125
|
+
#### End of system configuration section. ####
|
126
|
+
|
127
|
+
preload =
|
128
|
+
libpath = . $(libdir) /opt/local/lib
|
129
|
+
LIBPATH = -L. -L$(libdir) -L/opt/local/lib
|
130
|
+
DEFFILE =
|
131
|
+
|
132
|
+
CLEANFILES = mkmf.log
|
133
|
+
DISTCLEANFILES =
|
134
|
+
DISTCLEANDIRS =
|
135
|
+
|
136
|
+
extout =
|
137
|
+
extout_prefix =
|
138
|
+
target_prefix =
|
139
|
+
LOCAL_LIBS =
|
140
|
+
LIBS =
|
141
|
+
ORIG_SRCS =
|
142
|
+
SRCS = $(ORIG_SRCS) event.c selector.c kqueue.c
|
143
|
+
OBJS = event.o selector.o kqueue.o
|
144
|
+
HDRS = $(srcdir)/extconf.h
|
145
|
+
LOCAL_HDRS =
|
146
|
+
TARGET = IO_Event
|
147
|
+
TARGET_NAME = IO_Event
|
148
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
149
|
+
DLLIB = $(TARGET).bundle
|
150
|
+
EXTSTATIC =
|
151
|
+
STATIC_LIB =
|
152
|
+
|
153
|
+
TIMESTAMP_DIR = .
|
154
|
+
BINDIR = $(bindir)
|
155
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
156
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
157
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
158
|
+
HDRDIR = $(sitehdrdir)$(target_prefix)
|
159
|
+
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
160
|
+
TARGET_SO_DIR =
|
161
|
+
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
162
|
+
CLEANLIBS = $(TARGET_SO)
|
163
|
+
CLEANOBJS = *.o *.bak
|
164
|
+
|
165
|
+
all: $(DLLIB)
|
166
|
+
static: $(STATIC_LIB)
|
167
|
+
.PHONY: all install static install-so install-rb
|
168
|
+
.PHONY: clean clean-so clean-static clean-rb
|
169
|
+
|
170
|
+
clean-static::
|
171
|
+
clean-rb-default::
|
172
|
+
clean-rb::
|
173
|
+
clean-so::
|
174
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
175
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
176
|
+
|
177
|
+
distclean-rb-default::
|
178
|
+
distclean-rb::
|
179
|
+
distclean-so::
|
180
|
+
distclean-static::
|
181
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
182
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
183
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
184
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
185
|
+
|
186
|
+
realclean: distclean
|
187
|
+
install: install-so install-rb
|
188
|
+
|
189
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
190
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
191
|
+
clean-static::
|
192
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
193
|
+
install-rb: pre-install-rb do-install-rb install-rb-default
|
194
|
+
install-rb-default: pre-install-rb-default do-install-rb-default
|
195
|
+
pre-install-rb: Makefile
|
196
|
+
pre-install-rb-default: Makefile
|
197
|
+
do-install-rb:
|
198
|
+
do-install-rb-default:
|
199
|
+
pre-install-rb-default:
|
200
|
+
@$(NULLCMD)
|
201
|
+
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
202
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
203
|
+
$(Q) $(TOUCH) $@
|
204
|
+
|
205
|
+
site-install: site-install-so site-install-rb
|
206
|
+
site-install-so: install-so
|
207
|
+
site-install-rb: install-rb
|
208
|
+
|
209
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
210
|
+
|
211
|
+
.cc.o:
|
212
|
+
$(ECHO) compiling $(<)
|
213
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
214
|
+
|
215
|
+
.cc.S:
|
216
|
+
$(ECHO) translating $(<)
|
217
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
218
|
+
|
219
|
+
.mm.o:
|
220
|
+
$(ECHO) compiling $(<)
|
221
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
222
|
+
|
223
|
+
.mm.S:
|
224
|
+
$(ECHO) translating $(<)
|
225
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
226
|
+
|
227
|
+
.cxx.o:
|
228
|
+
$(ECHO) compiling $(<)
|
229
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
230
|
+
|
231
|
+
.cxx.S:
|
232
|
+
$(ECHO) translating $(<)
|
233
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
234
|
+
|
235
|
+
.cpp.o:
|
236
|
+
$(ECHO) compiling $(<)
|
237
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
238
|
+
|
239
|
+
.cpp.S:
|
240
|
+
$(ECHO) translating $(<)
|
241
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
242
|
+
|
243
|
+
.c.o:
|
244
|
+
$(ECHO) compiling $(<)
|
245
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
246
|
+
|
247
|
+
.c.S:
|
248
|
+
$(ECHO) translating $(<)
|
249
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
250
|
+
|
251
|
+
.m.o:
|
252
|
+
$(ECHO) compiling $(<)
|
253
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
254
|
+
|
255
|
+
.m.S:
|
256
|
+
$(ECHO) translating $(<)
|
257
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
258
|
+
|
259
|
+
$(TARGET_SO): $(OBJS) Makefile
|
260
|
+
$(ECHO) linking shared-object $(DLLIB)
|
261
|
+
-$(Q)$(RM) $(@)
|
262
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
263
|
+
$(Q) $(POSTLINK)
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|
data/ext/event.o
ADDED
Binary file
|
data/ext/extconf.h
ADDED
data/ext/extconf.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'mkmf'
|
24
|
+
|
25
|
+
gem_name = File.basename(__dir__)
|
26
|
+
extension_name = 'IO_Event'
|
27
|
+
|
28
|
+
# dir_config(extension_name)
|
29
|
+
|
30
|
+
$CFLAGS << " -Wall"
|
31
|
+
|
32
|
+
$srcs = ["io/event/event.c", "io/event/selector/selector.c"]
|
33
|
+
$VPATH << "$(srcdir)/io/event"
|
34
|
+
$VPATH << "$(srcdir)/io/event/selector"
|
35
|
+
|
36
|
+
have_func('rb_ext_ractor_safe')
|
37
|
+
have_func('&rb_fiber_transfer')
|
38
|
+
|
39
|
+
if have_library('uring') and have_header('liburing.h')
|
40
|
+
$srcs << "io/event/selector/uring.c"
|
41
|
+
end
|
42
|
+
|
43
|
+
if have_header('sys/epoll.h')
|
44
|
+
$srcs << "io/event/selector/epoll.c"
|
45
|
+
end
|
46
|
+
|
47
|
+
if have_header('sys/event.h')
|
48
|
+
$srcs << "io/event/selector/kqueue.c"
|
49
|
+
end
|
50
|
+
|
51
|
+
have_func("rb_io_descriptor")
|
52
|
+
have_func("&rb_process_status_wait")
|
53
|
+
have_func('rb_fiber_current')
|
54
|
+
have_func("&rb_fiber_raise")
|
55
|
+
|
56
|
+
have_header('ruby/io/buffer.h')
|
57
|
+
|
58
|
+
create_header
|
59
|
+
|
60
|
+
# Generate the makefile to compile the native binary into `lib`:
|
61
|
+
create_makefile(extension_name)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
// Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
//
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
// of this software and associated documentation files (the "Software"), to deal
|
5
|
+
// in the Software without restriction, including without limitation the rights
|
6
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
// copies of the Software, and to permit persons to whom the Software is
|
8
|
+
// furnished to do so, subject to the following conditions:
|
9
|
+
//
|
10
|
+
// The above copyright notice and this permission notice shall be included in
|
11
|
+
// all copies or substantial portions of the Software.
|
12
|
+
//
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
// THE SOFTWARE.
|
20
|
+
|
21
|
+
#include "event.h"
|
22
|
+
#include "selector/selector.h"
|
23
|
+
|
24
|
+
VALUE IO_Event = Qnil;
|
25
|
+
VALUE IO_Event_Selector = Qnil;
|
26
|
+
|
27
|
+
void Init_IO_Event()
|
28
|
+
{
|
29
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
30
|
+
rb_ext_ractor_safe(true);
|
31
|
+
#endif
|
32
|
+
|
33
|
+
IO_Event = rb_define_module_under(rb_cIO, "Event");
|
34
|
+
rb_gc_register_mark_object(IO_Event);
|
35
|
+
|
36
|
+
IO_Event_Selector = rb_define_module_under(IO_Event, "Selector");
|
37
|
+
rb_gc_register_mark_object(IO_Event_Selector);
|
38
|
+
|
39
|
+
Init_IO_Event_Selector(IO_Event_Selector);
|
40
|
+
|
41
|
+
#ifdef IO_EVENT_SELECTOR_URING
|
42
|
+
Init_IO_Event_Selector_URing(IO_Event_Selector);
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#ifdef IO_EVENT_SELECTOR_EPOLL
|
46
|
+
Init_IO_Event_Selector_EPoll(IO_Event_Selector);
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#ifdef IO_EVENT_SELECTOR_KQUEUE
|
50
|
+
Init_IO_Event_Selector_KQueue(IO_Event_Selector);
|
51
|
+
#endif
|
52
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
//
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
// of this software and associated documentation files (the "Software"), to deal
|
5
|
+
// in the Software without restriction, including without limitation the rights
|
6
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
// copies of the Software, and to permit persons to whom the Software is
|
8
|
+
// furnished to do so, subject to the following conditions:
|
9
|
+
//
|
10
|
+
// The above copyright notice and this permission notice shall be included in
|
11
|
+
// all copies or substantial portions of the Software.
|
12
|
+
//
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
// THE SOFTWARE.
|
20
|
+
|
21
|
+
#pragma once
|
22
|
+
|
23
|
+
#include <ruby.h>
|
24
|
+
|
25
|
+
#include "extconf.h"
|
26
|
+
|
27
|
+
void Init_IO_Event();
|
28
|
+
|
29
|
+
#ifdef HAVE_LIBURING_H
|
30
|
+
#include "selector/uring.h"
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#ifdef HAVE_SYS_EPOLL_H
|
34
|
+
#include "selector/epoll.h"
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#ifdef HAVE_SYS_EVENT_H
|
38
|
+
#include "selector/kqueue.h"
|
39
|
+
#endif
|