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  // SemacquireMutex is like Semacquire, but for profiling contended Mutexes.
    17  // If lifo is true, queue waiter at the head of wait queue.
    18  // skipframes is the number of frames to omit during tracing, counting from
    19  // runtime_SemacquireMutex's caller.
    20  func runtime_SemacquireMutex(s *uint32, lifo bool, skipframes int)
    21  
    22  // Semrelease atomically increments *s and notifies a waiting goroutine
    23  // if one is blocked in Semacquire.
    24  // It is intended as a simple wakeup primitive for use by the synchronization
    25  // library and should not be used directly.
    26  // If handoff is true, pass count directly to the first waiter.
    27  // skipframes is the number of frames to omit during tracing, counting from
    28  // runtime_Semrelease's caller.
    29  func runtime_Semrelease(s *uint32, handoff bool, skipframes int)
    30  
    31  // See runtime/sema.go for documentation.
    32  func runtime_notifyListAdd(l *notifyList) uint32
    33  
    34  // See runtime/sema.go for documentation.
    35  func runtime_notifyListWait(l *notifyList, t uint32)
    36  
    37  // See runtime/sema.go for documentation.
    38  func runtime_notifyListNotifyAll(l *notifyList)
    39  
    40  // See runtime/sema.go for documentation.
    41  func runtime_notifyListNotifyOne(l *notifyList)
    42  
    43  // Ensure that sync and runtime agree on size of notifyList.
    44  func runtime_notifyListCheck(size uintptr)
    45  func init() {
    46  	var n notifyList
    47  	runtime_notifyListCheck(unsafe.Sizeof(n))
    48  }
    49  
    50  // Active spinning runtime support.
    51  // runtime_canSpin reports whether spinning makes sense at the moment.
    52  func runtime_canSpin(i int) bool
    53  
    54  // runtime_doSpin does active spinning.
    55  func runtime_doSpin()
    56  
    57  func runtime_nanotime() int64
    58  

View as plain text