...
Source file
src/runtime/debuglog_on.go
Documentation: runtime
1
2
3
4
5
6
7 package runtime
8
9 const dlogEnabled = true
10
11
12
13 type dlogPerM struct {
14 dlogCache *dlogger
15 }
16
17
18
19 func getCachedDlogger() *dlogger {
20 mp := acquirem()
21
22
23
24
25 var l *dlogger
26 if getg() != mp.gsignal {
27 l = mp.dlogCache
28 mp.dlogCache = nil
29 }
30 releasem(mp)
31 return l
32 }
33
34
35
36 func putCachedDlogger(l *dlogger) bool {
37 mp := acquirem()
38 if getg() != mp.gsignal && mp.dlogCache == nil {
39 mp.dlogCache = l
40 releasem(mp)
41 return true
42 }
43 releasem(mp)
44 return false
45 }
46
View as plain text