diff options
author | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 |
commit | 1bb8f19f5e9016a9eb118b8aba2b5689b4505812 (patch) | |
tree | 7b69b0974f4999bac76d11abed2071a2dc9e97aa /src/pkg/runtime/darwin/thread.c | |
parent | 6b7539d607f26a1b1cd3eda71fc123ad4d52a133 (diff) | |
download | golang-1bb8f19f5e9016a9eb118b8aba2b5689b4505812.tar.gz |
8c, 8l dynamic loading support.
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.
on snow leopard:
- non-cgo binaries work; all tests pass.
- cgo binaries work on amd64 but not 386.
R=r
DELTA=2031 (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304
Diffstat (limited to 'src/pkg/runtime/darwin/thread.c')
-rw-r--r-- | src/pkg/runtime/darwin/thread.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pkg/runtime/darwin/thread.c b/src/pkg/runtime/darwin/thread.c index c394ab490..7e6d7c2d7 100644 --- a/src/pkg/runtime/darwin/thread.c +++ b/src/pkg/runtime/darwin/thread.c @@ -144,15 +144,18 @@ notewakeup(Note *n) void osinit(void) { - // Register our thread-creation callback (see {amd64,386}/sys.s). - bsdthread_register(); + // Register our thread-creation callback (see {amd64,386}/sys.s) + // but only if we're not using cgo. If we are using cgo we need + // to let the C pthread libary install its own thread-creation callback. + extern void (*libcgo_thread_start)(void*); + if(libcgo_thread_start == nil) + bsdthread_register(); } void newosproc(M *m, G *g, void *stk, void (*fn)(void)) { m->tls[0] = m->id; // so 386 asm can find it - if(0){ printf("newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p\n", stk, m, g, fn, m->id, m->tls[0], &m); |