1
0
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:
Sanjay Menakuru 2014-08-26 09:01:52 +04:00 committed by Dmitriy Vyukov
parent 32c0dce00e
commit 90653d7864
2 changed files with 20 additions and 12 deletions

View File

@ -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--;
}

View File

@ -114,15 +114,3 @@ func runtimepprof·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--;
}