Skip to content
Open
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
11 changes: 10 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,14 @@ jobs:
run: sudo apt-get install -y liburing-dev

- name: Run tests
timeout-minutes: 10
if: matrix.os != 'windows'
timeout-minutes: 15
run: bundle exec bake test

- name: Run tests (Windows)
if: matrix.os == 'windows'
timeout-minutes: 15
# Use bash on Windows so the MSYS2/UCRT64 toolchain is on PATH and
# shared-library linking against ws2_32 resolves correctly.
shell: bash
run: bundle exec bake test
11 changes: 10 additions & 1 deletion ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
$srcs << "io/event/selector/kqueue.c"
end

if /mingw|mswin/ =~ RUBY_PLATFORM
$srcs << "io/event/selector/iocp.c"
# Ensure the MinGW import-library path is in the linker search path.
mingw_lib = "#{ENV.fetch('MINGW_PREFIX', '/ucrt64')}/lib"
$LDFLAGS << " -L#{mingw_lib}" if File.directory?(mingw_lib)
have_library("ws2_32", "WSARecv", "winsock2.h")
end

have_header("sys/wait.h")

have_header("sys/eventfd.h")
Expand All @@ -62,7 +70,8 @@
# 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")
# The WorkerPool uses POSIX pthread semantics and is not supported on Windows.
if have_header("pthread.h") && !(/mingw|mswin/ =~ RUBY_PLATFORM)
append_cflags(["-DHAVE_IO_EVENT_WORKER_POOL"])
$srcs << "io/event/worker_pool.c"
$srcs << "io/event/worker_pool_test.c"
Expand Down
4 changes: 4 additions & 0 deletions ext/io/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ void Init_IO_Event(void)
#ifdef IO_EVENT_SELECTOR_KQUEUE
Init_IO_Event_Selector_KQueue(IO_Event_Selector);
#endif

#ifdef IO_EVENT_SELECTOR_IOCP
Init_IO_Event_Selector_IOCP(IO_Event_Selector);
#endif
}
4 changes: 4 additions & 0 deletions ext/io/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ void Init_IO_Event(void);
#include "selector/kqueue.h"
#endif

#ifdef _WIN32
#include "selector/iocp.h"
#endif

#ifdef HAVE_IO_EVENT_WORKER_POOL
#include "worker_pool.h"
#endif
Loading
Loading