aboutsummaryrefslogtreecommitdiff
path: root/src/libthread
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-04-23 05:17:54 +0000
committerrsc <devnull@localhost>2004-04-23 05:17:54 +0000
commit1aa4e9c82e91806e2ec09b0c05951a5fc299a812 (patch)
treed67bad9a32eecd7590be65da0414571f72ba8bbe /src/libthread
parente21fee604e3b53fd8c57ac3817e6d829f62d6ee3 (diff)
downloadplan9port-1aa4e9c82e91806e2ec09b0c05951a5fc299a812.tar.gz
plan9port-1aa4e9c82e91806e2ec09b0c05951a5fc299a812.tar.bz2
plan9port-1aa4e9c82e91806e2ec09b0c05951a5fc299a812.zip
little things
Diffstat (limited to 'src/libthread')
-rw-r--r--src/libthread/exec-unix.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libthread/exec-unix.c b/src/libthread/exec-unix.c
index 372923c1..a4a90d8b 100644
--- a/src/libthread/exec-unix.c
+++ b/src/libthread/exec-unix.c
@@ -4,7 +4,7 @@
#include "threadimpl.h"
static void efork(int[3], int[2], char*, char**);
-static void
+static int
_threadexec(Channel *pidc, int fd[3], char *prog, char *args[], int freeargs)
{
int pfd[2];
@@ -63,18 +63,26 @@ _threadexec(Channel *pidc, int fd[3], char *prog, char *args[], int freeargs)
sendul(pidc, pid);
_threaddebug(DBGEXEC, "threadexec schedexecwait");
- threadexits(0);
+ return pid;
Bad:
_threaddebug(DBGEXEC, "threadexec bad %r");
if(pidc)
sendul(pidc, ~0);
+ return -1;
}
void
threadexec(Channel *pidc, int fd[3], char *prog, char *args[])
{
- _threadexec(pidc, fd, prog, args, 0);
+ if(_threadexec(pidc, fd, prog, args, 0) >= 0)
+ threadexits(nil);
+}
+
+int
+threadspawn(int fd[3], char *prog, char *args[])
+{
+ return _threadexec(nil, fd, prog, args, 0);
}
/*