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 // Approximation of notifyList in runtime/sema.go. Size and alignment must 32 // agree. 33 type notifyList struct { 34 wait uint32 35 notify uint32 36 lock uintptr 37 head unsafe.Pointer 38 tail unsafe.Pointer 39 } 40 41 // See runtime/sema.go for documentation. 42 func runtime_notifyListAdd(l *notifyList) uint32 43 44 // See runtime/sema.go for documentation. 45 func runtime_notifyListWait(l *notifyList, t uint32) 46 47 // See runtime/sema.go for documentation. 48 func runtime_notifyListNotifyAll(l *notifyList) 49 50 // See runtime/sema.go for documentation. 51 func runtime_notifyListNotifyOne(l *notifyList) 52 53 // Ensure that sync and runtime agree on size of notifyList. 54 func runtime_notifyListCheck(size uintptr) 55 func init() { 56 var n notifyList 57 runtime_notifyListCheck(unsafe.Sizeof(n)) 58 } 59 60 // Active spinning runtime support. 61 // runtime_canSpin reports whether spinning makes sense at the moment. 62 func runtime_canSpin(i int) bool 63 64 // runtime_doSpin does active spinning. 65 func runtime_doSpin() 66 67 func runtime_nanotime() int64 68