libthread: run first thread in proc on system stack
For pthread systems that are fussy about which stack is used, this makes sure that threadmain runs on a system stack. If you only use proccreate (never threadcreate), all threads run on system stacks.
This commit is contained in:
parent
e0c4896ed4
commit
0158bceec7
4 changed files with 55 additions and 17 deletions
|
|
@ -8,7 +8,7 @@ execproc(void *v)
|
|||
int i, fd[3];
|
||||
char buf[100], *args[3];
|
||||
|
||||
i = (int)v;
|
||||
i = (int)(uintptr)v;
|
||||
sprint(buf, "%d", i);
|
||||
fd[0] = dup(0, -1);
|
||||
fd[1] = dup(1, -1);
|
||||
|
|
@ -33,7 +33,7 @@ threadmain(int argc, char **argv)
|
|||
|
||||
c = threadwaitchan();
|
||||
for(i=0;; i++){
|
||||
proccreate(execproc, (void*)i, 16384);
|
||||
proccreate(execproc, (void*)(uintptr)i, 16384);
|
||||
w = recvp(c);
|
||||
if(w == nil)
|
||||
sysfatal("exec/recvp failed: %r");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue