aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/plumb/fsys.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-12-26 02:10:47 +0000
committerrsc <devnull@localhost>2004-12-26 02:10:47 +0000
commitf99790979b4a659d7f6e490fbb8b26d630804eed (patch)
tree9f64ab5ea6faedb80fd2231faed4d42da51a471b /src/cmd/plumb/fsys.c
parent6a5c5d48705ef8374f5172731408f0f27b0f0dc6 (diff)
downloadplan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.tar.gz
plan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.tar.bz2
plan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.zip
update to use new thread library
Diffstat (limited to 'src/cmd/plumb/fsys.c')
-rw-r--r--src/cmd/plumb/fsys.c13
1 files changed, 9 insertions, 4 deletions
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));