Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@

have_header("ruby/io/buffer.h")

# Feature detection for blocking operation support
if have_func("rb_fiber_scheduler_blocking_operation_extract")
# Feature detection for pthread support (needed for WorkerPool)
if have_header("pthread.h")
append_cflags(["-DHAVE_IO_EVENT_WORKER_POOL"])
$srcs << "io/event/worker_pool.c"
$srcs << "io/event/worker_pool_test.c"
end
end

if ENV.key?("RUBY_SANITIZE")
$stderr.puts "Enabling sanitizers..."

Expand Down
6 changes: 5 additions & 1 deletion ext/io/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ void Init_IO_Event(void)
VALUE IO_Event = rb_define_module_under(rb_cIO, "Event");

Init_IO_Event_Fiber(IO_Event);


#ifdef HAVE_IO_EVENT_WORKER_POOL
Init_IO_Event_WorkerPool(IO_Event);
#endif

VALUE IO_Event_Selector = rb_define_module_under(IO_Event, "Selector");
Init_IO_Event_Selector(IO_Event_Selector);

Expand Down
4 changes: 4 additions & 0 deletions ext/io/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ void Init_IO_Event(void);
#ifdef HAVE_SYS_EVENT_H
#include "selector/kqueue.h"
#endif

#ifdef HAVE_IO_EVENT_WORKER_POOL
#include "worker_pool.h"
#endif
2 changes: 1 addition & 1 deletion ext/io/event/fiber.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VALUE IO_Event_Fiber_raise(VALUE fiber, int argc, VALUE *argv) {
#ifndef HAVE_RB_FIBER_CURRENT
static ID id_current;

static VALUE IO_Event_Fiber_current(void) {
VALUE IO_Event_Fiber_current(void) {
return rb_funcall(rb_cFiber, id_current, 0);
}
#endif
Expand Down
Loading
Loading