Skip to content

Commit a33306a

Browse files
committed
Fix Windows non-block IO.
1 parent 062130c commit a33306a

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

ext/io/event/selector/selector.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ VALUE IO_Event_Selector_process_status_wait(rb_pid_t pid, int flags)
2929
int IO_Event_Selector_nonblock_set(int file_descriptor)
3030
{
3131
#ifdef _WIN32
32-
u_long nonblock = 1;
33-
ioctlsocket(file_descriptor, FIONBIO, &nonblock);
34-
// Windows does not provide any way to know this, so we always restore it back to unset:
35-
return 0;
32+
rb_w32_set_nonblock(file_descriptor);
3633
#else
3734
// Get the current mode:
3835
int flags = fcntl(file_descriptor, F_GETFL, 0);
@@ -50,8 +47,6 @@ void IO_Event_Selector_nonblock_restore(int file_descriptor, int flags)
5047
{
5148
#ifdef _WIN32
5249
// Yolo...
53-
u_long nonblock = flags;
54-
ioctlsocket(file_descriptor, FIONBIO, &nonblock);
5550
#else
5651
// The flags didn't have O_NONBLOCK set, so it would have been set, so we need to restore it:
5752
if (!(flags & O_NONBLOCK)) {

0 commit comments

Comments
 (0)