File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1175,7 +1175,24 @@ VALUE IO_Event_Selector_URing_wakeup(VALUE self) {
11751175
11761176#pragma mark - Native Methods
11771177
1178+ int IO_Event_Selector_URing_supported_p () {
1179+ struct io_uring ring ;
1180+ int result = io_uring_queue_init (1 , & ring , 0 );
1181+
1182+ if (result < 0 ) {
1183+ return 0 ;
1184+ }
1185+
1186+ io_uring_queue_exit (& ring );
1187+
1188+ return 1 ;
1189+ }
1190+
11781191void Init_IO_Event_Selector_URing (VALUE IO_Event_Selector ) {
1192+ if (!IO_Event_Selector_URing_supported_p ()) {
1193+ return ;
1194+ }
1195+
11791196 VALUE IO_Event_Selector_URing = rb_define_class_under (IO_Event_Selector , "URing" , rb_cObject );
11801197
11811198 rb_define_alloc_func (IO_Event_Selector_URing , IO_Event_Selector_URing_allocate );
You can’t perform that action at this time.
0 commit comments