diff options
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 26 | 
1 files changed, 24 insertions, 2 deletions
| diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 1a1895dcb..169f90b73 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -544,8 +544,8 @@ gosched(void)  // The goroutine g is about to enter a system call.  // Record that it's not using the cpu anymore. -// This is called only from the go syscall library, not -// from the low-level system calls used by the runtime. +// This is called only from the go syscall library and cgocall, +// not from the low-level system calls used by the runtime.  void  ·entersyscall(void)  { @@ -604,6 +604,28 @@ void  	gosched();  } +// Start scheduling g1 again for a cgo callback. +void +startcgocallback(G* g1) +{ +	lock(&sched); +	g1->status = Grunning; +	sched.msyscall--; +	sched.mcpu++; +	unlock(&sched); +} + +// Stop scheduling g1 after a cgo callback. +void +endcgocallback(G* g1) +{ +	lock(&sched); +	g1->status = Gsyscall; +	sched.mcpu--; +	sched.msyscall++; +	unlock(&sched); +} +  /*   * stack layout parameters.   * known to linkers. | 
