github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/sync/runtime_amd64.go (about)

     1  // Copyright 2020 The gVisor Authors.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  //go:build amd64
     7  
     8  package sync
     9  
    10  import (
    11  	"sync/atomic"
    12  )
    13  
    14  const supportsWakeSuppression = true
    15  
    16  // addrOfSpinning returns the address of runtime.sched.nmspinning.
    17  func addrOfSpinning() *int32
    18  
    19  // nmspinning caches addrOfSpinning.
    20  var nmspinning = addrOfSpinning()
    21  
    22  //go:nosplit
    23  func preGoReadyWakeSuppression() {
    24  	atomic.AddInt32(nmspinning, 1)
    25  }
    26  
    27  //go:nosplit
    28  func postGoReadyWakeSuppression() {
    29  	atomic.AddInt32(nmspinning, -1)
    30  }