diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/runtime/cgocall.c | 11 | ||||
-rw-r--r-- | src/pkg/runtime/extern.go | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/runtime/cgocall.c b/src/pkg/runtime/cgocall.c index b2d1f33d8..3c9819b09 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 d002e4813..669ede36f 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 |