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