Source file src/sync/runtime.go

     1  // Copyright 2012 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  package sync
     6  
     7  import "unsafe"
     8  
     9  // defined in package runtime
    10  
    11  // Semacquire waits until *s > 0 and then atomically decrements it.
    12  // It is intended as a simple sleep primitive for use by the synchronization
    13  // library and should not be used directly.
    14  func runtime_Semacquire(s *uint32)
    15  
    16  // SemacquireWaitGroup is like Semacquire, but for WaitGroup.Wait.
    17  func runtime_SemacquireWaitGroup(s *uint32)
    18  
    19  // Semacquire(RW)Mutex(R) is like Semacquire, but for profiling contended
    20  // Mutexes and RWMutexes.
    21  // If lifo is true, queue waiter at the head of wait queue.
    22  // skipframes is the number of frames to omit during tracing, counting from
    23  // runtime_SemacquireMutex's caller.
    24  // The different forms of this function just tell the runtime how to present
    25  // the reason for waiting in a backtrace, and is used to compute some metrics.
    26  // Otherwise they're functionally identical.
    27  func runtime_SemacquireRWMutexR(s *uint32, lifo bool, skipframes int)
    28  func runtime_SemacquireRWMutex(s *uint32, lifo bool, skipframes int)
    29  
    30  // Semrelease atomically increments *s and notifies a waiting goroutine
    31  // if one is blocked in Semacquire.
    32  // It is intended as a simple wakeup primitive for use by the synchronization
    33  // library and should not be used directly.
    34  // If handoff is true, pass count directly to the first waiter.
    35  // skipframes is the number of frames to omit during tracing, counting from
    36  // runtime_Semrelease's caller.
    37  func runtime_Semrelease(s *uint32, handoff bool, skipframes int)
    38  
    39  // See runtime/sema.go for documentation.
    40  func runtime_notifyListAdd(l *notifyList) uint32
    41  
    42  // See runtime/sema.go for documentation.
    43  func runtime_notifyListWait(l *notifyList, t uint32)
    44  
    45  // See runtime/sema.go for documentation.
    46  func runtime_notifyListNotifyAll(l *notifyList)
    47  
    48  // See runtime/sema.go for documentation.
    49  func runtime_notifyListNotifyOne(l *notifyList)
    50  
    51  // Ensure that sync and runtime agree on size of notifyList.
    52  func runtime_notifyListCheck(size uintptr)
    53  func init() {
    54  	var n notifyList
    55  	runtime_notifyListCheck(unsafe.Sizeof(n))
    56  }
    57  
    58  func throw(string)
    59  func fatal(string)
    60  

View as plain text