From f99790979b4a659d7f6e490fbb8b26d630804eed Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 26 Dec 2004 02:10:47 +0000 Subject: update to use new thread library --- src/cmd/plumb/fsys.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/cmd/plumb') diff --git a/src/cmd/plumb/fsys.c b/src/cmd/plumb/fsys.c index 0ffd5053..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]); - threadcreate(fsysproc, nil, Stack); + proccreate(fsysproc, nil, Stack); } static void @@ -218,14 +218,19 @@ fsysproc(void *v) if(buf == nil) error("malloc failed: %r"); qlock(&readlock); - n = threadread9pmsg(srvfd, buf, messagesize); + n = read9pmsg(srvfd, buf, messagesize); if(n <= 0){ if(n < 0) error("i/o error on server channel"); threadexitsall("unmounted"); } - if(readlock.head == nil) /* no other processes waiting to read; start one */ - threadcreate(fsysproc, nil, Stack); + /* + * can give false positive (create an extra fsysproc) once in a while, + * but no false negatives, so good enough. once we have one extra + * we'll never have more. + */ + if(readlock.waiting.head == nil) /* no other processes waiting to read; start one */ + proccreate(fsysproc, nil, Stack); qunlock(&readlock); if(t == nil) t = emalloc(sizeof(Fcall)); -- cgit v1.2.3