From: Eric Wong Date: 2017-06-01T00:36:56+00:00 Subject: [ruby-core:81493] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid Pull request below for non-"git am" users... I tried my best to add many comments throughout the code. I realize this is a lot of new code; and not a typical or common usage of kqueue or epoll. The kqueue code ended up being very complicated to support corner cases (see comments in iom_kqueue); so perhaps the epoll implementation should be easiest-to-understand. I suggest understanding data structures, first; everything else will be easier. Please do not hesitate to ask here if you come across questions or bugs or any comments. Finally; libkqueue is broken (using epoll on Linux) for corner cases. I am using a FreeBSD 11.0 VM for kqueue development; but I may resume working with libkqueue upstream if I have time. I expect real-world Linux users to be using native epoll, of course; so no big problems, there. The following changes since commit d0015e4ac6b812ea1681b1f5fa86fbab52a58960: Improve performance of implicit type conversion (2017-05-31 12:30:57 +0000) are available in the git repository at: git://80x24.org/ruby iom for you to fetch changes up to 8d6b09d46fcdf6362d6f875347c4790d5cf86401: auto fiber schedule for rb_wait_for_single_fd and rb_waitpid (2017-06-01 00:07:18 +0000) ---------------------------------------------------------------- Eric Wong (1): auto fiber schedule for rb_wait_for_single_fd and rb_waitpid common.mk | 7 + configure.in | 32 ++ cont.c | 119 +++- include/ruby/io.h | 2 + iom.h | 92 ++++ iom_common.h | 198 +++++++ iom_epoll.h | 423 +++++++++++++++ iom_internal.h | 251 +++++++++ iom_kqueue.h | 600 +++++++++++++++++++++ iom_pingable_common.h | 46 ++ iom_select.h | 306 +++++++++++ prelude.rb | 12 + process.c | 14 +- signal.c | 40 +- .../wait_for_single_fd/test_wait_for_single_fd.rb | 44 ++ test/lib/leakchecker.rb | 9 + test/ruby/test_fiber_auto.rb | 238 ++++++++ thread.c | 42 ++ thread_pthread.c | 5 + vm.c | 9 + vm_core.h | 4 + 21 files changed, 2479 insertions(+), 14 deletions(-) create mode 100644 iom.h create mode 100644 iom_common.h create mode 100644 iom_epoll.h create mode 100644 iom_internal.h create mode 100644 iom_kqueue.h create mode 100644 iom_pingable_common.h create mode 100644 iom_select.h create mode 100644 test/ruby/test_fiber_auto.rb Unsubscribe: