Skip to content

Refactor IO.pipe blocking mode#15823

Merged
straight-shoota merged 3 commits intocrystal-lang:masterfrom
ysbaddaden:refactor/pipe-nonblocking
May 28, 2025
Merged

Refactor IO.pipe blocking mode#15823
straight-shoota merged 3 commits intocrystal-lang:masterfrom
ysbaddaden:refactor/pipe-nonblocking

Conversation

@ysbaddaden
Copy link
Collaborator

@ysbaddaden ysbaddaden commented May 24, 2025

Moves the creation of IO pipes to the event loop, so they decide to set the underlying file descriptor or handle to blocking or non blocking mode.

This is further reflected by the read_blocking and write_blocking args that now default to nil, instead of false, so the event loop will use its own requirements.

This is a delayed breaking change: the current event loops will all set O_NONBLOCK on the file descriptors, or FILE_FLAG_OVERLAPPED for IOCP by default, but future event loops can break this assumption (i.e. io_uring).

Related to #15685.
Builds on top to #15804.

@ysbaddaden ysbaddaden changed the title Refactor/pipe nonblocking Refactor IO.pipe blocking mode May 26, 2025
Moves the creation of IO pipes to the event loop, so they decide to set
the underlying file descriptor or handle to blocking or non blocking
mode.

This is further reflected by the read_blocking and write_blocking args
that now default to nil, instead of false, so the event loop will use
its own requirements.

This is a delayed breaking change: the current event loops will all set
O_NONBLOCK on the file descriptors, or FILE_FLAG_OVERLAPPED for IOCP, by
default, but future event loops can break this assumption (io_uring).
@ysbaddaden ysbaddaden force-pushed the refactor/pipe-nonblocking branch from e73ce90 to 0c0cf51 Compare May 26, 2025 15:59
@ysbaddaden ysbaddaden marked this pull request as ready for review May 26, 2025 15:59
@ysbaddaden ysbaddaden self-assigned this May 26, 2025
@ysbaddaden
Copy link
Collaborator Author

Rebased to remove #15804 and ready for review.

@straight-shoota straight-shoota added this to the 1.17.0 milestone May 26, 2025
@straight-shoota straight-shoota merged commit d9aac36 into crystal-lang:master May 28, 2025
36 checks passed
@ysbaddaden ysbaddaden deleted the refactor/pipe-nonblocking branch May 28, 2025 09:56
@straight-shoota straight-shoota added kind:breaking Intentional breaking change with significant impact. Shows up on top of the changelog. and removed kind:refactor labels Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:breaking Intentional breaking change with significant impact. Shows up on top of the changelog. topic:stdlib:files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants