about summary refs log tree commit homepage
path: root/ext/kgio/kgio.h
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-15 22:53:48 +0000
committerEric Wong <e@80x24.org>2016-12-15 23:51:08 +0000
commit333347c3ae54c8d605c673fcd11ff8dcb2ea4c38 (patch)
tree0663faa01cb9f84457a1b55ab52867ed986dd64c /ext/kgio/kgio.h
parent64dc570f4b99f68b5ed792b36e7e8abc3df74927 (diff)
downloadkgio-333347c3ae54c8d605c673fcd11ff8dcb2ea4c38.tar.gz
The regression for existing users was unnacceptable and
completely poor judgement on my part.  This change brings
us back to potentially not-future-compatible code which
will impose maintenance burdens on us in the face of
future Ruby changes.

But TODAY, it is the most performant option for folks who
need to use autopush.

Revert "resurrect Kgio.autopush support in pure Ruby"
and "remove autopush support and make it a no-op"

This reverts commits 64dc570f4b99f68b5ed792b36e7e8abc3df74927
and 4347980fa66115425fa8b765353c8b1bfe5dec24.
Diffstat (limited to 'ext/kgio/kgio.h')
-rw-r--r--ext/kgio/kgio.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/kgio/kgio.h b/ext/kgio/kgio.h
index a3f2f66..c0630ae 100644
--- a/ext/kgio/kgio.h
+++ b/ext/kgio/kgio.h
@@ -29,9 +29,14 @@ void init_kgio_write(void);
 void init_kgio_writev(void);
 void init_kgio_accept(void);
 void init_kgio_connect(void);
+void init_kgio_autopush(void);
 void init_kgio_poll(void);
 void init_kgio_tryopen(void);
 
+void kgio_autopush_accept(VALUE, VALUE);
+void kgio_autopush_recv(VALUE);
+void kgio_autopush_send(VALUE);
+
 VALUE kgio_call_wait_writable(VALUE io);
 VALUE kgio_call_wait_readable(VALUE io);
 #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
@@ -85,6 +90,13 @@ NORETURN(void kgio_rd_sys_fail(const char *));
 #    define USE_MSG_DONTWAIT
 #  endif
 
+#ifdef USE_MSG_DONTWAIT
+/* we don't need these variants, we call kgio_autopush_send/recv directly */
+static inline void kgio_autopush_write(VALUE io) { }
+#else
+static inline void kgio_autopush_write(VALUE io) { kgio_autopush_send(io); }
+#endif
+
 /* prefer rb_str_subseq because we don't use negative offsets */
 #ifndef HAVE_RB_STR_SUBSEQ
 #define MY_STR_SUBSEQ(str,beg,len) rb_str_substr((str),(beg),(len))