aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-08-25 15:37:22 -0700
committerRuss Cox <rsc@golang.org>2009-08-25 15:37:22 -0700
commit67815ef65b462b60006ee361538e04fe6913a2bd (patch)
treec4b71e65348225e9010fa51e6bdf22c471eca4f4 /src/pkg/runtime
parent75a38963ca9144cbbc55ef32c25b020e668eeb40 (diff)
downloadgo-67815ef65b462b60006ee361538e04fe6913a2bd.tar.xz
checkpoint & test (pidigits) before trying to automate.
R=r DELTA=616 (598 added, 11 deleted, 7 changed) OCL=33846 CL=33848
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/cgocall.c11
-rw-r--r--src/pkg/runtime/extern.go3
2 files changed, 14 insertions, 0 deletions
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