Add comments clarifying thread-safety (#282)

This commit is contained in:
Dmitry Kovba
2025-09-08 23:15:22 -07:00
committed by GitHub
parent 9aa552593b
commit 1b1cfdbaf3
6 changed files with 8 additions and 5 deletions
@@ -267,6 +267,7 @@ extension SocketRelay {
)
}
// `buf1` isn't used concurrently.
nonisolated(unsafe) let buf1 = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: Int(getpagesize()))
connSource.setEventHandler {
Self.fdCopyHandler(
@@ -278,6 +279,7 @@ extension SocketRelay {
}
nonisolated(unsafe) let buf2 = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: Int(getpagesize()))
// `buf2` isn't used concurrently.
vsockConnectionSource.setEventHandler {
Self.fdCopyHandler(
buffer: buf2,