libthread: add threadspawnd

R=rsc
http://codereview.appspot.com/6742064
This commit is contained in:
Russ Cox 2012-10-22 12:32:09 -04:00
parent 81c2c5e775
commit 9e4b56e764
4 changed files with 28 additions and 6 deletions

View file

@ -42,6 +42,7 @@ threadsetgrp,
threadsetname,
threadsetstate,
threadspawn,
threadspawnd,
threadspawnl,
threadwaitchan,
yield \- thread and proc management
@ -124,6 +125,7 @@ int chanprint(Channel *c, char *fmt, ...)
.XX
int threadspawnl(int fd[3], char *file, ...)
int threadspawn(int fd[3], char *file, char *args[])
int threadspawnd(int fd[3], char *file, char *args[], char *dir)
int threadexecl(Channel *cpid, int fd[3], char *file, ...)
int threadexec(Channel *cpid, int fd[3], char *file, char *args[])
Channel* threadwaitchan(void)
@ -240,6 +242,8 @@ Calls that do this are
.IR threadexecl ,
.IR threadexits ,
.IR threadspawn ,
.IR threadspawnd ,
.IR threadspawnl ,
.IR alt ,
.IR send ,
and
@ -419,6 +423,13 @@ and
but do not replace the current thread.
They return the pid of the invoked program on success, or
\-1 on error.
.I Threadspawnd
is like
.I threadspawn
but takes as its final argument the directory in which to run the invoked program.
The child will attempt to change into that directory before running the program,
but it is only best effort: failure to change into the directory does not
stop the running of the program.
.PP
.I Threadwaitchan
returns a channel of pointers to