aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pserve.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2007-08-22 09:14:25 -0400
committerRuss Cox <rsc@swtch.com>2007-08-22 09:14:25 -0400
commit4a6f0510731b99025c51ce4dc35eee08f697f91a (patch)
treefad7515ca92b2d788f32951ed67e06e5e0b831c7 /src/cmd/9pserve.c
parentebda53e16b473c6ad8df070edd6f58e2e1e10994 (diff)
downloadplan9port-4a6f0510731b99025c51ce4dc35eee08f697f91a.tar.gz
plan9port-4a6f0510731b99025c51ce4dc35eee08f697f91a.tar.bz2
plan9port-4a6f0510731b99025c51ce4dc35eee08f697f91a.zip
9pserve: fix a new race involving assert(c->nmsg == 0).
Just like outputthread can have processed the message but not yet called msgput, the same is true of the connoutthread, so we cannot check c->nmsg until after the connoutthread has shut down gracefully.
Diffstat (limited to 'src/cmd/9pserve.c')
-rw-r--r--src/cmd/9pserve.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c
index f7b76bf9..ab27e61a 100644
--- a/src/cmd/9pserve.c
+++ b/src/cmd/9pserve.c
@@ -560,13 +560,13 @@ connthread(void *arg)
sendq(outq, &sync);
recvp(c->outqdead);
- /* should be no messages left anywhere. */
- assert(c->nmsg == 0);
-
/* everything is quiet; can close the local output queue. */
sendq(c->outq, nil);
recvp(c->outqdead);
+ /* should be no messages left anywhere. */
+ assert(c->nmsg == 0);
+
/* clunk all outstanding fids */
for(i=0; i<NHASH; i++){
for(h=c->fid[i]; h; h=hnext){