Source file src/vendor/golang.org/x/net/quic/race_enabled.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build race
     6  
     7  package quic
     8  
     9  import (
    10  	"runtime"
    11  	"unsafe"
    12  )
    13  
    14  // Our synchronization here is rather coarse-grained since we always use the
    15  // address of quicSync. As such, it will not differentiate between, for
    16  // example, reads and writes to different QUIC streams.
    17  // However, this is consistent with our synchronization for net/http, and
    18  // mostly only matters for testing.
    19  var quicSync uint64
    20  
    21  func raceAcquire() {
    22  	runtime.RaceAcquire(unsafe.Pointer(&quicSync))
    23  }
    24  
    25  func raceReleaseMerge() {
    26  	runtime.RaceReleaseMerge(unsafe.Pointer(&quicSync))
    27  }
    28  

View as plain text