Source file src/internal/sync/runtime.go
1 // Copyright 2024 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 // SemacquireMutex is like Semacquire, but for profiling contended 12 // Mutexes and RWMutexes. 13 // If lifo is true, queue waiter at the head of wait queue. 14 // skipframes is the number of frames to omit during tracing, counting from 15 // runtime_SemacquireMutex's caller. 16 // The different forms of this function just tell the runtime how to present 17 // the reason for waiting in a backtrace, and is used to compute some metrics. 18 // Otherwise they're functionally identical. 19 // 20 //go:linkname runtime_SemacquireMutex 21 func runtime_SemacquireMutex(s *uint32, lifo bool, skipframes int) 22 23 // Semrelease atomically increments *s and notifies a waiting goroutine 24 // if one is blocked in Semacquire. 25 // It is intended as a simple wakeup primitive for use by the synchronization 26 // library and should not be used directly. 27 // If handoff is true, pass count directly to the first waiter. 28 // skipframes is the number of frames to omit during tracing, counting from 29 // runtime_Semrelease's caller. 30 // 31 //go:linkname runtime_Semrelease 32 func runtime_Semrelease(s *uint32, handoff bool, skipframes int) 33 34 // Active spinning runtime support. 35 // runtime_canSpin reports whether spinning makes sense at the moment. 36 // 37 //go:linkname runtime_canSpin 38 func runtime_canSpin(i int) bool 39 40 // runtime_doSpin does active spinning. 41 // 42 //go:linkname runtime_doSpin 43 func runtime_doSpin() 44 45 //go:linkname runtime_nanotime 46 func runtime_nanotime() int64 47 48 //go:linkname throw 49 func throw(string) 50 51 //go:linkname fatal 52 func fatal(string) 53