diff --git a/ext/io/event/selector/epoll.c b/ext/io/event/selector/epoll.c index 98d0490f..ca859130 100644 --- a/ext/io/event/selector/epoll.c +++ b/ext/io/event/selector/epoll.c @@ -473,6 +473,8 @@ VALUE process_wait_ensure(VALUE _arguments) { return Qnil; } +struct IO_Event_List_Type IO_Event_Selector_EPoll_process_wait_list_type = {}; + VALUE IO_Event_Selector_EPoll_process_wait(VALUE self, VALUE fiber, VALUE _pid, VALUE _flags) { struct IO_Event_Selector_EPoll *selector = NULL; TypedData_Get_Struct(self, struct IO_Event_Selector_EPoll, &IO_Event_Selector_EPoll_Type, selector); @@ -489,7 +491,7 @@ VALUE IO_Event_Selector_EPoll_process_wait(VALUE self, VALUE fiber, VALUE _pid, rb_update_max_fd(descriptor); struct IO_Event_Selector_EPoll_Waiting waiting = { - .list = {.type = 1}, + .list = {.type = &IO_Event_Selector_EPoll_process_wait_list_type}, .fiber = fiber, .events = IO_EVENT_READABLE, }; @@ -538,6 +540,8 @@ VALUE io_wait_transfer(VALUE _arguments) { } }; +struct IO_Event_List_Type IO_Event_Selector_EPoll_io_wait_list_type = {}; + VALUE IO_Event_Selector_EPoll_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE events) { struct IO_Event_Selector_EPoll *selector = NULL; TypedData_Get_Struct(self, struct IO_Event_Selector_EPoll, &IO_Event_Selector_EPoll_Type, selector); @@ -545,7 +549,7 @@ VALUE IO_Event_Selector_EPoll_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE e int descriptor = IO_Event_Selector_io_descriptor(io); struct IO_Event_Selector_EPoll_Waiting waiting = { - .list = {.type = 1}, + .list = {.type = &IO_Event_Selector_EPoll_io_wait_list_type}, .fiber = fiber, .events = RB_NUM2INT(events), }; diff --git a/ext/io/event/selector/kqueue.c b/ext/io/event/selector/kqueue.c index 0515e1a8..432f305a 100644 --- a/ext/io/event/selector/kqueue.c +++ b/ext/io/event/selector/kqueue.c @@ -476,6 +476,8 @@ VALUE process_wait_ensure(VALUE _arguments) { return Qnil; } +struct IO_Event_List_Type IO_Event_Selector_KQueue_process_wait_list_type = {}; + VALUE IO_Event_Selector_KQueue_process_wait(VALUE self, VALUE fiber, VALUE _pid, VALUE _flags) { struct IO_Event_Selector_KQueue *selector = NULL; TypedData_Get_Struct(self, struct IO_Event_Selector_KQueue, &IO_Event_Selector_KQueue_Type, selector); @@ -483,7 +485,7 @@ VALUE IO_Event_Selector_KQueue_process_wait(VALUE self, VALUE fiber, VALUE _pid, pid_t pid = NUM2PIDT(_pid); struct IO_Event_Selector_KQueue_Waiting waiting = { - .list = {.type = 1}, + .list = {.type = &IO_Event_Selector_KQueue_process_wait_list_type}, .fiber = fiber, .events = IO_EVENT_EXIT, }; @@ -536,6 +538,8 @@ VALUE io_wait_transfer(VALUE _arguments) { } } +struct IO_Event_List_Type IO_Event_Selector_KQueue_io_wait_list_type = {}; + VALUE IO_Event_Selector_KQueue_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE events) { struct IO_Event_Selector_KQueue *selector = NULL; TypedData_Get_Struct(self, struct IO_Event_Selector_KQueue, &IO_Event_Selector_KQueue_Type, selector); @@ -543,7 +547,7 @@ VALUE IO_Event_Selector_KQueue_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE int descriptor = IO_Event_Selector_io_descriptor(io); struct IO_Event_Selector_KQueue_Waiting waiting = { - .list = {.type = 1}, + .list = {.type = &IO_Event_Selector_KQueue_io_wait_list_type}, .fiber = fiber, .events = RB_NUM2INT(events), }; diff --git a/ext/io/event/selector/list.h b/ext/io/event/selector/list.h index a3fce77e..45bb5841 100644 --- a/ext/io/event/selector/list.h +++ b/ext/io/event/selector/list.h @@ -4,9 +4,12 @@ #include #include +struct IO_Event_List_Type { +}; + struct IO_Event_List { struct IO_Event_List *head, *tail; - void *type; + struct IO_Event_List_Type *type; }; inline static void IO_Event_List_initialize(struct IO_Event_List *list)