summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-02-08 21:41:54 -0800
committerRuss Cox <rsc@golang.org>2010-02-08 21:41:54 -0800
commit4227e0fcd8ab454433d9c3d94da6eae68dfc1689 (patch)
tree97dc24869f546fd7032625f3b2159ab8afbd1000 /src/pkg/runtime/proc.c
parent572ffc76eca67ff28370cb29fc76ebcbe2aeb8cd (diff)
downloadgolang-4227e0fcd8ab454433d9c3d94da6eae68dfc1689.tar.gz
runtime: allow arbitrary return type in SetFinalizer.
finalize chan, to free OS X semaphore inside Lock. os: finalize File, to close fd. Fixes issue 503. R=ken2 CC=golang-dev http://codereview.appspot.com/204065
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index b162f4676..5bd92dd80 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -766,11 +766,18 @@ malg(int32 stacksize)
void
·newproc(int32 siz, byte* fn, byte* arg0)
{
+ newproc1(fn, (byte*)&arg0, siz, 0);
+}
+
+void
+newproc1(byte *fn, byte *argp, int32 narg, int32 nret)
+{
byte *stk, *sp;
G *newg;
+ int32 siz;
-//printf("newproc siz=%d fn=%p", siz, fn);
-
+//printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret);
+ siz = narg + nret;
siz = (siz+7) & ~7;
if(siz > 1024)
throw("runtime.newproc: too many args");
@@ -793,7 +800,7 @@ void
newg->stackbase = sp;
sp -= siz;
- mcpy(sp, (byte*)&arg0, siz);
+ mcpy(sp, argp, narg);
newg->sched.sp = sp;
newg->sched.pc = (byte*)goexit;