Skip to content

Let Crystal::EventLoop#close do the actual close (not just cleanup)#15641

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:refactor/event-loop-close
Apr 19, 2025
Merged

Let Crystal::EventLoop#close do the actual close (not just cleanup)#15641
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:refactor/event-loop-close

Conversation

@ysbaddaden
Copy link
Collaborator

@ysbaddaden ysbaddaden commented Apr 7, 2025

Internal refactor to have the Crystal::EventLoop#close(io) implementations be responsible from actually closing the file descriptor or socket, not only do some internal cleanup before closing. They now follow the abstract methods documentation:

Closes the file descriptor|socket resource.

This will allow the io_uring event loop to close asynchronously.

Adds a #close_volatile_fd? helper on UNIX that will prove helpful in io_uring.

Follow-up to #15640
Extracted from #15634

@straight-shoota straight-shoota added this to the 1.17.0 milestone Apr 15, 2025
@ysbaddaden ysbaddaden force-pushed the refactor/event-loop-close branch from 80e93ce to ac5ebb5 Compare April 18, 2025 10:48
Internal refactor to have the `Crystal::EventLoop#close(io)`
implementations be responsible from actually closing the file descriptor
or socket, not only do some internal cleanup before closing.

This will allow the io_uring event loop to close asynchronously for
example.
@ysbaddaden ysbaddaden force-pushed the refactor/event-loop-close branch from ac5ebb5 to 4cf666d Compare April 18, 2025 10:49
@ysbaddaden
Copy link
Collaborator Author

Rebased with master to remove the commit from #15640 + renamed the _fd variables to fd.

@straight-shoota straight-shoota merged commit 08616f2 into crystal-lang:master Apr 19, 2025
34 checks passed
@ysbaddaden ysbaddaden deleted the refactor/event-loop-close branch April 24, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants