From: Sanjay Menakuru Date: Tue, 26 Aug 2014 05:01:52 +0000 (+0400) Subject: runtime,sync: Convert procPin and procUnpin functions to Go. X-Git-Tag: go1.4beta1~692 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=90653d7864818ebfc3a71eaf11c6ee9cdc7c1609;p=gostls13.git runtime,sync: Convert procPin and procUnpin functions to Go. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/132880043 --- diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 483903d6d9..1f687ebc92 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -3292,3 +3292,23 @@ haveexperiment(int8 *name) } 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--; +} diff --git a/src/pkg/runtime/runtime1.goc b/src/pkg/runtime/runtime1.goc index a95a4f944d..9529d6504b 100644 --- a/src/pkg/runtime/runtime1.goc +++ b/src/pkg/runtime/runtime1.goc @@ -114,15 +114,3 @@ func runtime∕pprof·runtime_cyclesPerSecond() (res int64) { 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--; -}