aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/thread.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2011-08-02 14:28:04 -0400
committerRuss Cox <rsc@swtch.com>2011-08-02 14:28:04 -0400
commitfc567f476a9cb381a50a94a355c4e0dd990b2539 (patch)
tree9bfabb0a7d3c13f6e853b47e0eae7e7d9c888c31 /src/libthread/thread.c
parentbabe3439cc2bb8baa027be65da67d02d980ebb05 (diff)
build: OS X 64-bit build
R=rsc http://codereview.appspot.com/4838047
Diffstat (limited to 'src/libthread/thread.c')
-rw-r--r--src/libthread/thread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 06230f53..731a68cb 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -91,7 +91,7 @@ threadstart(uint y, uint x)
z |= y;
t = (_Thread*)z;
-/*print("threadstart %p\n", v); */
+//print("threadstart sp=%p arg=%p startfn=%p t=%p\n", &t, t, t->startfn, t->startarg);
t->startfn(t->startarg);
/*print("threadexits %p\n", v); */
threadexits(nil);
@@ -114,17 +114,21 @@ threadalloc(void (*fn)(void*), void *arg, uint stack)
t->stk = (uchar*)(t+1);
t->stksize = stack;
t->id = incref(&threadidref);
+//print("fn=%p arg=%p\n", fn, arg);
t->startfn = fn;
t->startarg = arg;
+//print("makecontext sp=%p t=%p startfn=%p\n", (char*)t->stk+t->stksize, t, t->startfn);
/* do a reasonable initialization */
memset(&t->context.uc, 0, sizeof t->context.uc);
sigemptyset(&zero);
sigprocmask(SIG_BLOCK, &zero, &t->context.uc.uc_sigmask);
+//print("makecontext sp=%p t=%p startfn=%p\n", (char*)t->stk+t->stksize, t, t->startfn);
/* must initialize with current context */
if(getcontext(&t->context.uc) < 0)
sysfatal("threadalloc getcontext: %r");
+//print("makecontext sp=%p t=%p startfn=%p\n", (char*)t->stk+t->stksize, t, t->startfn);
/* call makecontext to do the real work. */
/* leave a few words open on both ends */
@@ -141,6 +145,7 @@ threadalloc(void (*fn)(void*), void *arg, uint stack)
* function that takes some number of word-sized variables,
* and on 64-bit machines pointers are bigger than words.
*/
+//print("makecontext sp=%p t=%p startfn=%p\n", (char*)t->stk+t->stksize, t, t->startfn);
z = (ulong)t;
y = z;
z >>= 16; /* hide undefined 32-bit shift from 32-bit compilers */