Source file
src/runtime/netpoll_stub.go
1
2
3
4
5
6
7 package runtime
8
9 import "internal/runtime/atomic"
10
11 var netpollInited atomic.Uint32
12
13 var netpollStubLock mutex
14 var netpollNote note
15
16
17 var netpollBrokenLock mutex
18 var netpollBroken bool
19
20 func netpollGenericInit() {
21 netpollInited.Store(1)
22 }
23
24 func netpollBreak() {
25 lock(&netpollBrokenLock)
26 broken := netpollBroken
27 netpollBroken = true
28 if !broken {
29 notewakeup(&netpollNote)
30 }
31 unlock(&netpollBrokenLock)
32 }
33
34
35
36
37
38 func netpoll(delay int64) (gList, int32) {
39
40
41 if delay != 0 {
42
43
44 lock(&netpollStubLock)
45
46 lock(&netpollBrokenLock)
47 noteclear(&netpollNote)
48 netpollBroken = false
49 unlock(&netpollBrokenLock)
50
51 notetsleep(&netpollNote, delay)
52 unlock(&netpollStubLock)
53
54
55 osyield()
56 }
57 return gList{}, 0
58 }
59
60 func netpollinited() bool {
61 return netpollInited.Load() != 0
62 }
63
64 func netpollAnyWaiters() bool {
65 return false
66 }
67
68 func netpollAdjustWaiters(delta int32) {
69 }
70
View as plain text