-
Russ Cox authored
This CL adds 'dropg', which is called to drop the association between m and its current goroutine, and it makes schedule handle locked goroutines correctly, instead of requiring all callers of schedule to do that. The effect is that if you want to take over an m for, say, garbage collection work while still allowing the current g to run on some other m, you can do an mcall to a function that is: // dissociate gp dropg(); gp->status = Gwaiting; // for ready // put gp on run queue for others to find runtime·ready(gp); /* ... do other work here ... */ // done with m, let it run goroutines again schedule(); Before this CL, the dropg() body had to be written explicitly, and the check for lockedg before schedule had to be written explicitly too, both of which make the code a bit more fragile than it needs to be. LGTM=iant R=dvyukov, iant CC=golang-codereviews, rlh https://golang.org/cl/113110043
64c2083e