Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Delta Between Two Patch Sets: src/runtime/proc.go

Issue 183140043: code review 183140043: all: merge dev.garbage (d1238958d4ae) into default branch (Closed)
Left Patch Set: Created 10 years, 3 months ago
Right Patch Set: diff -r 4d000340a76822ab21a6393ab03313971f6ea01d https://code.google.com/p/go/ Created 10 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/runtime/print1.go ('k') | src/runtime/proc1.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2014 The Go Authors. All rights reserved. 1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package runtime 5 package runtime
6 6
7 import "unsafe" 7 import "unsafe"
8 8
9 func runtime_init() 9 func runtime_init()
10 func main_init() 10 func main_init()
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Delicate dance: the semaphore implementation calls 174 // Delicate dance: the semaphore implementation calls
175 // acquireSudog, acquireSudog calls new(sudog), 175 // acquireSudog, acquireSudog calls new(sudog),
176 // new calls malloc, malloc can call the garbage collector, 176 // new calls malloc, malloc can call the garbage collector,
177 // and the garbage collector calls the semaphore implementation 177 // and the garbage collector calls the semaphore implementation
178 // in stoptheworld. 178 // in stoptheworld.
179 // Break the cycle by doing acquirem/releasem around new(sudog). 179 // Break the cycle by doing acquirem/releasem around new(sudog).
180 // The acquirem/releasem increments m.locks during new(sudog), 180 // The acquirem/releasem increments m.locks during new(sudog),
181 // which keeps the garbage collector from being invoked. 181 // which keeps the garbage collector from being invoked.
182 mp := acquirem() 182 mp := acquirem()
183 p := new(sudog) 183 p := new(sudog)
184 if p.elem != nil {
185 gothrow("acquireSudog: found p.elem != nil after new")
186 }
184 releasem(mp) 187 releasem(mp)
185 return p 188 return p
186 } 189 }
187 190
188 //go:nosplit 191 //go:nosplit
189 func releaseSudog(s *sudog) { 192 func releaseSudog(s *sudog) {
190 if s.elem != nil { 193 if s.elem != nil {
191 gothrow("runtime: sudog with non-nil elem") 194 gothrow("runtime: sudog with non-nil elem")
192 } 195 }
193 if s.selectdone != nil { 196 if s.selectdone != nil {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if readgstatus(gp) == _Gidle { 260 if readgstatus(gp) == _Gidle {
258 gothrow("allgadd: bad status Gidle") 261 gothrow("allgadd: bad status Gidle")
259 } 262 }
260 263
261 lock(&allglock) 264 lock(&allglock)
262 allgs = append(allgs, gp) 265 allgs = append(allgs, gp)
263 allg = &allgs[0] 266 allg = &allgs[0]
264 allglen = uintptr(len(allgs)) 267 allglen = uintptr(len(allgs))
265 unlock(&allglock) 268 unlock(&allglock)
266 } 269 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b