Continue fighting pthreads.

Clean up thread library a bit too.
This commit is contained in:
rsc 2004-09-23 03:01:36 +00:00
parent c6687d4591
commit 7966faa931
19 changed files with 539 additions and 654 deletions

View file

@ -5,11 +5,16 @@ extern int _threaddebuglevel;
void
doexec(void *v)
{
int fd[3];
char **argv = v;
print("doexec\n");
procexec(nil, argv[0], argv);
fd[0] = dup(0, -1);
fd[1] = dup(1, -1);
fd[2] = dup(2, -1);
threadexec(nil, fd, argv[0], argv);
print("exec failed: %r\n");
sendp(threadwaitchan(), nil);
threadexits(nil);
}
void
@ -28,7 +33,7 @@ threadmain(int argc, char **argv)
proccreate(doexec, argv, 8192);
w = recvp(c);
if(w == nil)
print("exec failed: %r\n");
print("exec/recvp failed: %r\n");
else
print("%d %lud %lud %lud %s\n", w->pid, w->time[0], w->time[1], w->time[2], w->msg);
threadexits(nil);