]> Cypherpunks repositories - gostls13.git/commit
internal/poll: use fdMutex to provide read/write locking on Windows
authorqmuntal <quimmuntal@gmail.com>
Thu, 21 Aug 2025 13:29:46 +0000 (15:29 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Mon, 25 Aug 2025 09:31:40 +0000 (02:31 -0700)
commita21249436b6e1fd47356361d53dc053bbc074f90
tree9a3bed000f6025dda8fba6399d14f9dbd1c22bb3
parent44c5956bf7454ca178c596eb87578ea61d6c9dee
internal/poll: use fdMutex to provide read/write locking on Windows

On Windows it is not possible to do concurrent I/O on file handles due
to the way FD.Pread and FD.Pwrite are implemented. This serialization is
achieved by having a dedicated mutex locked in the affected FD methods.

This makes the code difficult to reason about, as there is another
layer of locking introduced by the fdMutex. For example, it is not
obvious that concurrent I/O operations are serialized.

This CL removed the dedicated mutex and uses the fdMutex to provide
read/write locking.

Change-Id: I00389662728ce29428a587c3189bab90a0399215
Reviewed-on: https://go-review.googlesource.com/c/go/+/698096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/internal/poll/fd_mutex.go
src/internal/poll/fd_windows.go