event 0.9.4 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ede0cef441063c9e8675858ccbb0fb10a9e14403e812829531f8a5fedf144499
4
- data.tar.gz: 47519c0f64233d29be411f6148cb1c831734ed36a56f863881d5fa14e2f7245e
3
+ metadata.gz: 0d6712e3b3815d43fc8c720632c4c53cfb7773af7f3c45061ba3eb6ac5e30ead
4
+ data.tar.gz: 5b89b74d0e74f069522551a13cbe66ab53906a42015a2961c5bd048c3a983c01
5
5
  SHA512:
6
- metadata.gz: 16a588ae4f5319f430ffd31cf0374defaf099b87db406f27c6af8b667666038725587dfac4d3b328a5496a65335882263b846de1a67934df432beaceae23cff7
7
- data.tar.gz: 61a29c0c4379953b56ac6aef3b002513ac58603f16b2c9656afb61fcfbb91b9954a47bbf3bb04a414977f7ba11205974e229c1d38856fc491b84124cae7814cf
6
+ metadata.gz: ae853db3d4ba645d0097c214ed31b2ef6a146005f10d3a5ac6adb5e07da05fedf1ea349aacdc46e26225905b027dfb5e8d9b4be3a900e1fc9e2417e21229d6f2
7
+ data.tar.gz: c6a8650c86d26c1fb0ce43b5beefee190b186f2f87278ecbfc9dc67b60c226ec2d2aa2f61f8575e6b144beda1b08c080ac25288edcfd08576db8b1d32cc6357c
@@ -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.2/include/ruby-3.0.0
16
+ hdrdir = $(topdir)
17
+ arch_hdrdir = /Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20
18
+ PATH_SEPARATOR = :
19
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/selector
20
+ prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.0.2
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 =
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 = x86_64-darwin20
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 = /event
139
+ LOCAL_LIBS =
140
+ LIBS =
141
+ ORIG_SRCS = event.c
142
+ SRCS = $(ORIG_SRCS) event.c selector.c kqueue.c
143
+ OBJS = event.o selector.o kqueue.o
144
+ HDRS = $(srcdir)/event.h $(srcdir)/extconf.h
145
+ LOCAL_HDRS =
146
+ TARGET = event
147
+ TARGET_NAME = 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.-.event.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.-.event.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 event/$(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)
Binary file
data/ext/event/event.c CHANGED
@@ -31,7 +31,10 @@ void Init_event()
31
31
  #endif
32
32
 
33
33
  Event = rb_define_module("Event");
34
+ rb_gc_register_mark_object(Event);
35
+
34
36
  Event_Selector = rb_define_module_under(Event, "Selector");
37
+ rb_gc_register_mark_object(Event_Selector);
35
38
 
36
39
  Init_Event_Selector(Event_Selector);
37
40
 
data/ext/event/event.o ADDED
Binary file
@@ -0,0 +1,6 @@
1
+ #ifndef EXTCONF_H
2
+ #define EXTCONF_H
3
+ #define HAVE_RB_EXT_RACTOR_SAFE 1
4
+ #define HAVE_SYS_EVENT_H 1
5
+ #define HAVE_RB_FIBER_CURRENT 1
6
+ #endif
Binary file
@@ -0,0 +1,274 @@
1
+ have_func: checking for rb_ext_ractor_safe()... -------------------- yes
2
+
3
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
4
+ checked program was:
5
+ /* begin */
6
+ 1: #include "ruby.h"
7
+ 2:
8
+ 3: int main(int argc, char **argv)
9
+ 4: {
10
+ 5: return !!argv[argc];
11
+ 6: }
12
+ /* end */
13
+
14
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
15
+ checked program was:
16
+ /* begin */
17
+ 1: #include "ruby.h"
18
+ 2:
19
+ 3: /*top*/
20
+ 4: extern int t(void);
21
+ 5: int main(int argc, char **argv)
22
+ 6: {
23
+ 7: if (argc > 1000000) {
24
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
25
+ 9: printf("%d", (*tp)());
26
+ 10: }
27
+ 11:
28
+ 12: return !!argv[argc];
29
+ 13: }
30
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_ext_ractor_safe; return !p; }
31
+ /* end */
32
+
33
+ --------------------
34
+
35
+ have_func: checking for &rb_fiber_transfer()... -------------------- no
36
+
37
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -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.
42
+ checked program was:
43
+ /* begin */
44
+ 1: #include "ruby.h"
45
+ 2:
46
+ 3: /*top*/
47
+ 4: extern int t(void);
48
+ 5: int main(int argc, char **argv)
49
+ 6: {
50
+ 7: if (argc > 1000000) {
51
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
52
+ 9: printf("%d", (*tp)());
53
+ 10: }
54
+ 11:
55
+ 12: return !!argv[argc];
56
+ 13: }
57
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; }
58
+ /* end */
59
+
60
+ --------------------
61
+
62
+ have_library: checking for -luring... -------------------- no
63
+
64
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc -luring "
65
+ ld: library not found for -luring
66
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
67
+ checked program was:
68
+ /* begin */
69
+ 1: #include "ruby.h"
70
+ 2:
71
+ 3: /*top*/
72
+ 4: extern int t(void);
73
+ 5: int main(int argc, char **argv)
74
+ 6: {
75
+ 7: if (argc > 1000000) {
76
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
77
+ 9: printf("%d", (*tp)());
78
+ 10: }
79
+ 11:
80
+ 12: return !!argv[argc];
81
+ 13: }
82
+ 14:
83
+ 15: int t(void) { ; return 0; }
84
+ /* end */
85
+
86
+ --------------------
87
+
88
+ have_header: checking for sys/epoll.h... -------------------- no
89
+
90
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -o conftest.i"
91
+ conftest.c:3:10: fatal error: 'sys/epoll.h' file not found
92
+ #include <sys/epoll.h>
93
+ ^~~~~~~~~~~~~
94
+ 1 error generated.
95
+ checked program was:
96
+ /* begin */
97
+ 1: #include "ruby.h"
98
+ 2:
99
+ 3: #include <sys/epoll.h>
100
+ /* end */
101
+
102
+ --------------------
103
+
104
+ have_header: checking for sys/event.h... -------------------- yes
105
+
106
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -o conftest.i"
107
+ checked program was:
108
+ /* begin */
109
+ 1: #include "ruby.h"
110
+ 2:
111
+ 3: #include <sys/event.h>
112
+ /* end */
113
+
114
+ --------------------
115
+
116
+ have_func: checking for rb_io_descriptor()... -------------------- no
117
+
118
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
119
+ conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
120
+ int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
121
+ ^
122
+ 1 error generated.
123
+ checked program was:
124
+ /* begin */
125
+ 1: #include "ruby.h"
126
+ 2:
127
+ 3: /*top*/
128
+ 4: extern int t(void);
129
+ 5: int main(int argc, char **argv)
130
+ 6: {
131
+ 7: if (argc > 1000000) {
132
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
133
+ 9: printf("%d", (*tp)());
134
+ 10: }
135
+ 11:
136
+ 12: return !!argv[argc];
137
+ 13: }
138
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
139
+ /* end */
140
+
141
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
142
+ Undefined symbols for architecture x86_64:
143
+ "_rb_io_descriptor", referenced from:
144
+ _t in conftest-24343b.o
145
+ ld: symbol(s) not found for architecture x86_64
146
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
147
+ checked program was:
148
+ /* begin */
149
+ 1: #include "ruby.h"
150
+ 2:
151
+ 3: /*top*/
152
+ 4: extern int t(void);
153
+ 5: int main(int argc, char **argv)
154
+ 6: {
155
+ 7: if (argc > 1000000) {
156
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
157
+ 9: printf("%d", (*tp)());
158
+ 10: }
159
+ 11:
160
+ 12: return !!argv[argc];
161
+ 13: }
162
+ 14: extern void rb_io_descriptor();
163
+ 15: int t(void) { rb_io_descriptor(); return 0; }
164
+ /* end */
165
+
166
+ --------------------
167
+
168
+ have_func: checking for &rb_process_status_wait()... -------------------- no
169
+
170
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
171
+ conftest.c:14:76: error: use of undeclared identifier 'rb_process_status_wait'
172
+ int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
173
+ ^
174
+ 1 error generated.
175
+ checked program was:
176
+ /* begin */
177
+ 1: #include "ruby.h"
178
+ 2:
179
+ 3: /*top*/
180
+ 4: extern int t(void);
181
+ 5: int main(int argc, char **argv)
182
+ 6: {
183
+ 7: if (argc > 1000000) {
184
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
185
+ 9: printf("%d", (*tp)());
186
+ 10: }
187
+ 11:
188
+ 12: return !!argv[argc];
189
+ 13: }
190
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
191
+ /* end */
192
+
193
+ --------------------
194
+
195
+ have_func: checking for rb_fiber_current()... -------------------- yes
196
+
197
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
198
+ checked program was:
199
+ /* begin */
200
+ 1: #include "ruby.h"
201
+ 2:
202
+ 3: /*top*/
203
+ 4: extern int t(void);
204
+ 5: int main(int argc, char **argv)
205
+ 6: {
206
+ 7: if (argc > 1000000) {
207
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
208
+ 9: printf("%d", (*tp)());
209
+ 10: }
210
+ 11:
211
+ 12: return !!argv[argc];
212
+ 13: }
213
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_current; return !p; }
214
+ /* end */
215
+
216
+ --------------------
217
+
218
+ have_func: checking for &rb_fiber_raise()... -------------------- no
219
+
220
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.2/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
221
+ conftest.c:14:76: error: use of undeclared identifier 'rb_fiber_raise'; did you mean 'rb_fiber_resume'?
222
+ int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
223
+ ^~~~~~~~~~~~~~
224
+ rb_fiber_resume
225
+ /Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/internal/intern/cont.h:32:7: note: 'rb_fiber_resume' declared here
226
+ VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
227
+ ^
228
+ 1 error generated.
229
+ checked program was:
230
+ /* begin */
231
+ 1: #include "ruby.h"
232
+ 2:
233
+ 3: /*top*/
234
+ 4: extern int t(void);
235
+ 5: int main(int argc, char **argv)
236
+ 6: {
237
+ 7: if (argc > 1000000) {
238
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
239
+ 9: printf("%d", (*tp)());
240
+ 10: }
241
+ 11:
242
+ 12: return !!argv[argc];
243
+ 13: }
244
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
245
+ /* end */
246
+
247
+ --------------------
248
+
249
+ have_header: checking for ruby/io/buffer.h... -------------------- no
250
+
251
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/x86_64-darwin20 -I/Users/samuel/.rubies/ruby-3.0.2/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.2/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 conftest.c -o conftest.i"
252
+ conftest.c:3:10: fatal error: 'ruby/io/buffer.h' file not found
253
+ #include <ruby/io/buffer.h>
254
+ ^~~~~~~~~~~~~~~~~~
255
+ 1 error generated.
256
+ checked program was:
257
+ /* begin */
258
+ 1: #include "ruby.h"
259
+ 2:
260
+ 3: #include <ruby/io/buffer.h>
261
+ /* end */
262
+
263
+ --------------------
264
+
265
+ extconf.h is:
266
+ /* begin */
267
+ 1: #ifndef EXTCONF_H
268
+ 2: #define EXTCONF_H
269
+ 3: #define HAVE_RB_EXT_RACTOR_SAFE 1
270
+ 4: #define HAVE_SYS_EVENT_H 1
271
+ 5: #define HAVE_RB_FIBER_CURRENT 1
272
+ 6: #endif
273
+ /* end */
274
+
@@ -550,6 +550,7 @@ VALUE Event_Selector_EPoll_select(VALUE self, VALUE duration) {
550
550
 
551
551
  void Init_Event_Selector_EPoll(VALUE Event_Selector) {
552
552
  Event_Selector_EPoll = rb_define_class_under(Event_Selector, "EPoll", rb_cObject);
553
+ rb_gc_register_mark_object(Event_Selector_EPoll);
553
554
 
554
555
  rb_define_alloc_func(Event_Selector_EPoll, Event_Selector_EPoll_allocate);
555
556
  rb_define_method(Event_Selector_EPoll, "initialize", Event_Selector_EPoll_initialize, 1);
@@ -618,6 +618,7 @@ VALUE Event_Selector_KQueue_select(VALUE self, VALUE duration) {
618
618
 
619
619
  void Init_Event_Selector_KQueue(VALUE Event_Selector) {
620
620
  Event_Selector_KQueue = rb_define_class_under(Event_Selector, "KQueue", rb_cObject);
621
+ rb_gc_register_mark_object(Event_Selector_KQueue);
621
622
 
622
623
  rb_define_alloc_func(Event_Selector_KQueue, Event_Selector_KQueue_allocate);
623
624
  rb_define_method(Event_Selector_KQueue, "initialize", Event_Selector_KQueue_initialize, 1);
@@ -21,6 +21,8 @@
21
21
  #include "selector.h"
22
22
  #include <fcntl.h>
23
23
 
24
+ static const int DEBUG = 0;
25
+
24
26
  static ID id_transfer, id_alive_p;
25
27
 
26
28
  VALUE Event_Selector_fiber_transfer(VALUE fiber, int argc, VALUE *argv) {
@@ -113,6 +115,7 @@ void Init_Event_Selector(VALUE Event_Selector) {
113
115
  #ifndef HAVE_RB_PROCESS_STATUS_WAIT
114
116
  id_wait = rb_intern("wait");
115
117
  rb_Process_Status = rb_const_get_at(rb_mProcess, rb_intern("Status"));
118
+ rb_gc_register_mark_object(rb_Process_Status);
116
119
  #endif
117
120
  }
118
121
 
@@ -238,6 +241,7 @@ void Event_Selector_queue_push(struct Event_Selector *backend, VALUE fiber)
238
241
  static inline
239
242
  void Event_Selector_queue_pop(struct Event_Selector *backend, struct Event_Selector_Queue *ready)
240
243
  {
244
+ if (DEBUG) fprintf(stderr, "Event_Selector_queue_pop -> %p\n", (void*)ready->fiber);
241
245
  if (ready->flags & EVENT_SELECTOR_QUEUE_FIBER) {
242
246
  Event_Selector_fiber_transfer(ready->fiber, 0, NULL);
243
247
  } else {
@@ -257,10 +261,12 @@ int Event_Selector_queue_flush(struct Event_Selector *backend)
257
261
 
258
262
  // Get the current tail and head of the queue:
259
263
  struct Event_Selector_Queue *waiting = backend->waiting;
264
+ if (DEBUG) fprintf(stderr, "Event_Selector_queue_flush waiting = %p\n", waiting);
260
265
 
261
266
  // Process from head to tail in order:
262
267
  // During this, more items may be appended to tail.
263
268
  while (backend->ready) {
269
+ if (DEBUG) fprintf(stderr, "backend->ready = %p\n", backend->ready);
264
270
  struct Event_Selector_Queue *ready = backend->ready;
265
271
 
266
272
  count += 1;
@@ -615,6 +615,7 @@ VALUE Event_Selector_URing_select(VALUE self, VALUE duration) {
615
615
 
616
616
  void Init_Event_Selector_URing(VALUE Event_Selector) {
617
617
  Event_Selector_URing = rb_define_class_under(Event_Selector, "URing", rb_cObject);
618
+ rb_gc_register_mark_object(Event_Selector_URing);
618
619
 
619
620
  rb_define_alloc_func(Event_Selector_URing, Event_Selector_URing_allocate);
620
621
  rb_define_method(Event_Selector_URing, "initialize", Event_Selector_URing_initialize, 1);
Binary file
@@ -22,6 +22,7 @@ require "event/version"
22
22
 
23
23
  module Event
24
24
  module Debug
25
+ # Enforces the selector interface and delegates operations to a wrapped selector instance.
25
26
  class Selector
26
27
  def initialize(selector)
27
28
  @selector = selector
@@ -0,0 +1,55 @@
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
+ require_relative 'selector'
22
+
23
+ module Event
24
+ # A thread safe synchronisation primative.
25
+ class Interrupt
26
+ def self.attach(selector, &block)
27
+ self.new(selector, block)
28
+ end
29
+
30
+ def initialize(selector, block)
31
+ @selector = selector
32
+ @input, @output = ::IO.pipe
33
+
34
+ @fiber = Fiber.new do
35
+ while true
36
+ @selector.io_wait(@fiber, @input, READABLE)
37
+ block.call(@input.read_nonblock(1)&.ord)
38
+ end
39
+ end
40
+
41
+ @fiber.transfer
42
+ end
43
+
44
+ # Send a sigle byte interrupt.
45
+ def signal(event = 0)
46
+ @output.write(event.chr)
47
+ @output.flush
48
+ end
49
+
50
+ def close
51
+ @input.close
52
+ @output.close
53
+ end
54
+ end
55
+ end
@@ -21,6 +21,11 @@
21
21
  require_relative 'selector/select'
22
22
 
23
23
  module Event
24
+ # These constants are the same as those defined in IO.
25
+ READABLE = 1
26
+ PRIORITY = 2
27
+ WRITABLE = 4
28
+
24
29
  module Selector
25
30
  def self.default(env = ENV)
26
31
  if name = env['EVENT_SELECTOR']&.to_sym
data/lib/event/version.rb CHANGED
@@ -1,3 +1,23 @@
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
+
1
21
  module Event
2
- VERSION = "0.9.4"
22
+ VERSION = "1.0.3"
3
23
  end
data/lib/event.rb CHANGED
@@ -20,14 +20,7 @@
20
20
 
21
21
  require_relative 'event/version'
22
22
  require_relative 'event/selector'
23
-
24
- module Event
25
- # These constants are the same as those defined in IO.
26
-
27
- READABLE = 1
28
- PRIORITY = 2
29
- WRITABLE = 4
30
- end
23
+ require_relative 'event/interrupt'
31
24
 
32
25
  begin
33
26
  require_relative '../ext/event/event'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-15 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bake
@@ -73,9 +73,16 @@ extensions:
73
73
  - ext/event/extconf.rb
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ext/event/Makefile
77
+ - ext/event/event.bundle
76
78
  - ext/event/event.c
77
79
  - ext/event/event.h
80
+ - ext/event/event.o
81
+ - ext/event/extconf.h
78
82
  - ext/event/extconf.rb
83
+ - ext/event/kqueue.o
84
+ - ext/event/mkmf.log
85
+ - ext/event/selector.o
79
86
  - ext/event/selector/epoll.c
80
87
  - ext/event/selector/epoll.h
81
88
  - ext/event/selector/kqueue.c
@@ -87,6 +94,7 @@ files:
87
94
  - ext/event/selector/uring.h
88
95
  - lib/event.rb
89
96
  - lib/event/debug/selector.rb
97
+ - lib/event/interrupt.rb
90
98
  - lib/event/selector.rb
91
99
  - lib/event/selector/select.rb
92
100
  - lib/event/version.rb
@@ -109,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
117
  - !ruby/object:Gem::Version
110
118
  version: '0'
111
119
  requirements: []
112
- rubygems_version: 3.3.0.dev
120
+ rubygems_version: 3.2.22
113
121
  signing_key:
114
122
  specification_version: 4
115
123
  summary: An event loop.