diff options
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r-- | libgo/runtime/proc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 88831d41a67..34566fbf9a0 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -42,7 +42,6 @@ extern void *__splitstack_find(void *, void *, size_t *, void **, void **, #endif static void schedule(G*); -static M *startm(void); typedef struct Sched Sched; @@ -128,7 +127,7 @@ struct Sched { volatile uint32 atomic; // atomic scheduling word (see below) int32 profilehz; // cpu profiling rate - + bool init; // running initialization bool lockmain; // init called runtime.LockOSThread @@ -826,7 +825,7 @@ runtime_starttheworld(bool extra) // but m is not running a specific goroutine, // so set the helpgc flag as a signal to m's // first schedule(nil) to mcpu-- and grunning--. - m = startm(); + m = runtime_newm(); m->helpgc = 1; runtime_sched.grunning++; } @@ -876,8 +875,6 @@ struct CgoThreadStart }; // Kick off new m's as needed (up to mcpumax). -// There are already `other' other cpus that will -// start looking for goroutines shortly. // Sched is locked. static void matchmg(void) @@ -895,13 +892,14 @@ matchmg(void) // Find the m that will run gp. if((mp = mget(gp)) == nil) - mp = startm(); + mp = runtime_newm(); mnextg(mp, gp); } } -static M* -startm(void) +// Create a new m. It will start off with a call to runtime_mstart. +M* +runtime_newm(void) { M *m; pthread_attr_t attr; @@ -1135,6 +1133,7 @@ runtime_exitsyscall(void) runtime_memclr(gp->gcregs, sizeof gp->gcregs); } +// Allocate a new g, with a stack big enough for stacksize bytes. G* runtime_malg(int32 stacksize, byte** ret_stack, size_t* ret_stacksize) { @@ -1283,6 +1282,7 @@ runtime_Gosched(void) runtime_gosched(); } +// Implementation of runtime.GOMAXPROCS. // delete when scheduler is stronger int32 runtime_gomaxprocsfunc(int32 n) @@ -1390,6 +1390,7 @@ static struct { uintptr pcbuf[100]; } prof; +// Called if we receive a SIGPROF signal. void runtime_sigprof(uint8 *pc __attribute__ ((unused)), uint8 *sp __attribute__ ((unused)), @@ -1412,6 +1413,7 @@ runtime_sigprof(uint8 *pc __attribute__ ((unused)), runtime_unlock(&prof); } +// Arrange to call fn with a traceback hz times a second. void runtime_setcpuprofilerate(void (*fn)(uintptr*, int32), int32 hz) { |