From 67815ef65b462b60006ee361538e04fe6913a2bd Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 25 Aug 2009 15:37:22 -0700 Subject: checkpoint & test (pidigits) before trying to automate. R=r DELTA=616 (598 added, 11 deleted, 7 changed) OCL=33846 CL=33848 --- src/pkg/runtime/cgocall.c | 11 +++++++++++ src/pkg/runtime/extern.go | 3 +++ 2 files changed, 14 insertions(+) (limited to 'src/pkg/runtime') diff --git a/src/pkg/runtime/cgocall.c b/src/pkg/runtime/cgocall.c index b2d1f33d8c..3c9819b09d 100644 --- a/src/pkg/runtime/cgocall.c +++ b/src/pkg/runtime/cgocall.c @@ -6,6 +6,7 @@ #include "cgocall.h" Cgo *cgo; /* filled in by dynamic linker when Cgo is available */ +int64 ncgocall; void cgocall(void (*fn)(void*), void *arg) @@ -13,6 +14,8 @@ cgocall(void (*fn)(void*), void *arg) CgoWork w; CgoServer *s; + ncgocall++; + if(cgo == nil) throw("cgocall unavailable"); @@ -36,3 +39,11 @@ cgocall(void (*fn)(void*), void *arg) } notesleep(&w.note); } + +void +runtime·Cgocalls(int64 ret) +{ + ret = ncgocall; + FLUSH(&ret); +} + diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go index d002e48136..669ede36f3 100644 --- a/src/pkg/runtime/extern.go +++ b/src/pkg/runtime/extern.go @@ -43,3 +43,6 @@ func UnlockOSThread() // GOMAXPROCS sets the maximum number of CPUs that can be executing // simultaneously. This call will go away when the scheduler improves. func GOMAXPROCS(n int) + +// Cgocalls returns the number of cgo calls made by the current process. +func Cgocalls() int64 -- cgit v1.3-5-g9baa