mirror of
https://github.com/golang/go
synced 2024-11-19 03:54:42 -07:00
runtime,sync: Convert procPin and procUnpin functions to Go.
LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/132880043
This commit is contained in:
parent
32c0dce00e
commit
90653d7864
@ -3292,3 +3292,23 @@ haveexperiment(int8 *name)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma textflag NOSPLIT
|
||||||
|
void
|
||||||
|
sync·runtime_procPin(intptr p)
|
||||||
|
{
|
||||||
|
M *mp;
|
||||||
|
|
||||||
|
mp = g->m;
|
||||||
|
// Disable preemption.
|
||||||
|
mp->locks++;
|
||||||
|
p = mp->p->id;
|
||||||
|
FLUSH(&p);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma textflag NOSPLIT
|
||||||
|
void
|
||||||
|
sync·runtime_procUnpin()
|
||||||
|
{
|
||||||
|
g->m->locks--;
|
||||||
|
}
|
||||||
|
@ -114,15 +114,3 @@ func runtime∕pprof·runtime_cyclesPerSecond() (res int64) {
|
|||||||
res = runtime·tickspersecond();
|
res = runtime·tickspersecond();
|
||||||
}
|
}
|
||||||
|
|
||||||
func sync·runtime_procPin() (p int) {
|
|
||||||
M *mp;
|
|
||||||
|
|
||||||
mp = g->m;
|
|
||||||
// Disable preemption.
|
|
||||||
mp->locks++;
|
|
||||||
p = mp->p->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
func sync·runtime_procUnpin() {
|
|
||||||
g->m->locks--;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user