commit f4b26b64bc699519008009dad72c3248a2e414a0 from: rsc date: Tue Jan 04 22:17:10 2005 UTC do threading right commit - b10db40d3b82f192cc04b70305e4ec24109edf46 commit + f4b26b64bc699519008009dad72c3248a2e414a0 blob - 837f45adb1cbe8e9aa685fe3ef7703cc88f44eae blob + e9be1eb65f8a140838151190729a2ea944c3dc98 --- src/cmd/plumb/fsys.c +++ 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 blob - 968953d6428f2caf2d481e40afb1767dd21aa2b2 blob + 53847cd40f840f85c5cc5292c7759801e0fcbb89 --- src/cmd/plumb/plumber.c +++ 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); }