2017-07-25 Tamar Christina <tamar.christina@arm.com>
[official-gcc.git] / libgo / go / sync / runtime.go
blob4d22ce6b0dace53f98a020ec41b2708ca0491088
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.
5 package sync
7 import "unsafe"
9 // defined in package runtime
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)
16 // SemacquireMutex is like Semacquire, but for profiling contended Mutexes.
17 func runtime_SemacquireMutex(*uint32)
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)
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
35 // See runtime/sema.go for documentation.
36 func runtime_notifyListAdd(l *notifyList) uint32
38 // See runtime/sema.go for documentation.
39 func runtime_notifyListWait(l *notifyList, t uint32)
41 // See runtime/sema.go for documentation.
42 func runtime_notifyListNotifyAll(l *notifyList)
44 // See runtime/sema.go for documentation.
45 func runtime_notifyListNotifyOne(l *notifyList)
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))
54 // Active spinning runtime support.
55 // runtime_canSpin returns true is spinning makes sense at the moment.
56 func runtime_canSpin(i int) bool
58 // runtime_doSpin does active spinning.
59 func runtime_doSpin()