diff options
author | rsc <devnull@localhost> | 2005-01-04 22:17:10 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-01-04 22:17:10 +0000 |
commit | f4b26b64bc699519008009dad72c3248a2e414a0 (patch) | |
tree | d8d5d4ab716c3ae13df99c47ad13e7347af90f0b /src/cmd/plumb | |
parent | b10db40d3b82f192cc04b70305e4ec24109edf46 (diff) | |
download | plan9port-f4b26b64bc699519008009dad72c3248a2e414a0.tar.gz plan9port-f4b26b64bc699519008009dad72c3248a2e414a0.tar.bz2 plan9port-f4b26b64bc699519008009dad72c3248a2e414a0.zip |
do threading right
Diffstat (limited to 'src/cmd/plumb')
-rw-r--r-- | src/cmd/plumb/fsys.c | 2 | ||||
-rw-r--r-- | src/cmd/plumb/plumber.c | 28 |
2 files changed, 4 insertions, 26 deletions
diff --git a/src/cmd/plumb/fsys.c b/src/cmd/plumb/fsys.c index 837f45ad..e9be1eb6 100644 --- a/src/cmd/plumb/fsys.c +++ b/src/cmd/plumb/fsys.c @@ -199,7 +199,7 @@ startfsys(void) if(post9pservice(p[1], "plumb") < 0) sysfatal("post9pservice plumb: %r"); close(p[1]); - fsysproc(nil); + proccreate(fsysproc, nil, Stack); } static void diff --git a/src/cmd/plumb/plumber.c b/src/cmd/plumb/plumber.c index 968953d6..53847cd4 100644 --- a/src/cmd/plumb/plumber.c +++ b/src/cmd/plumb/plumber.c @@ -26,35 +26,17 @@ makeports(Ruleset *rules[]) } void -mainproc(void *v) -{ - Channel *c; - - c = v; - printerrors = 0; - makeports(rules); - startfsys(); - sendp(c, nil); -} - -void threadmain(int argc, char *argv[]) { char buf[512]; int fd; - int volatile dofork; - Channel *c; progname = "plumber"; - dofork = 1; ARGBEGIN{ case 'd': debug = 1; break; - case 'f': - dofork = 0; - break; case 'p': plumbfile = ARGF(); break; @@ -83,17 +65,13 @@ threadmain(int argc, char *argv[]) rules = readrules(plumbfile, fd); close(fd); - if(dofork) - threaddaemonize(); - /* * Start all processes and threads from other proc * so we (main pid) can return to user. */ - c = chancreate(sizeof(void*), 0); - proccreate(mainproc, c, 8192); - recvp(c); - chanfree(c); + printerrors = 0; + makeports(rules); + startfsys(); threadexits(nil); } |