]> Cypherpunks repositories - gostls13.git/commit
internal/poll: defer IOCP association until first IO operation
authorqmuntal <quimmuntal@gmail.com>
Tue, 1 Apr 2025 08:19:36 +0000 (10:19 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 1 Apr 2025 18:58:06 +0000 (11:58 -0700)
commit75bf2a8c493291481af72a07a818c432085919ca
tree72b9f43d61792403992cd14296ce50fde9f5bc3f
parent7177f2400995901b666b1ed94d87c15c8c410fab
internal/poll: defer IOCP association until first IO operation

Defer the association of the IOCP to the handle until the first
I/O operation is performed.

A handle can only be associated with one IOCP at a time, so this allows
external code to associate the handle with their own IOCP and still be
able to use a FD (through os.NewFile) to pass the handle around
(e.g. to a child process standard input, output, and error) without
having to worry about the IOCP association.

This CL doesn't change any user-visible behavior, as os.NewFile still
initializes the FD as non-pollable.

For #19098.

Change-Id: Id22a49846d4fda3a66ffcc0bc1b48eb39b395dc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/661955
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/poll/fd_plan9.go
src/internal/poll/fd_poll_runtime.go
src/internal/poll/fd_unix.go
src/internal/poll/fd_windows.go
src/internal/poll/fd_windows_test.go
src/internal/syscall/windows/syscall_windows.go
src/internal/syscall/windows/zsyscall_windows.go