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 func runtime_SemacquireMutex(*uint32) 18 19 // Semrelease atomically increments *s and notifies a waiting goroutine 20 // if one is blocked in Semacquire. 21 // It is intended as a simple wakeup primitive for use by the synchronization 22 // library and should not be used directly. 23 func runtime_Semrelease(s *uint32) 24 25 // Approximation of notifyList in runtime/sema.go. Size and alignment must 26 // agree. 27 type notifyList struct { 28 wait uint32 29 notify uint32 30 lock uintptr 31 head unsafe.Pointer 32 tail unsafe.Pointer 33 } 34 35 // See runtime/sema.go for documentation. 36 func runtime_notifyListAdd(l *notifyList) uint32 37 38 // See runtime/sema.go for documentation. 39 func runtime_notifyListWait(l *notifyList, t uint32) 40 41 // See runtime/sema.go for documentation. 42 func runtime_notifyListNotifyAll(l *notifyList) 43 44 // See runtime/sema.go for documentation. 45 func runtime_notifyListNotifyOne(l *notifyList) 46 47 // Ensure that sync and runtime agree on size of notifyList. 48 func runtime_notifyListCheck(size uintptr) 49 func init() { 50 var n notifyList 51 runtime_notifyListCheck(unsafe.Sizeof(n)) 52 } 53 54 // Active spinning runtime support. 55 // runtime_canSpin returns true is spinning makes sense at the moment. 56 func runtime_canSpin(i int) bool 57 58 // runtime_doSpin does active spinning. 59 func runtime_doSpin() 60