summaryrefslogtreecommitdiff
path: root/sys/src/9/port/qio.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-07-09 13:15:39 +0200
committercinap_lenrek <cinap_lenrek@localhost>2011-07-09 13:15:39 +0200
commitb222c16a38c27a77cacd004500b9cf2c067a89d5 (patch)
tree77d932717301c0dbadda4de5f5531e009e839e48 /sys/src/9/port/qio.c
parentd1dcdf2df3c69d76b7a6a1b950324ce85942edc3 (diff)
qio: naive fixing attempt on issue #64
Diffstat (limited to 'sys/src/9/port/qio.c')
-rw-r--r--sys/src/9/port/qio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/src/9/port/qio.c b/sys/src/9/port/qio.c
index 76b04be2b..aa4de59f3 100644
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -1156,8 +1156,6 @@ qnotfull(void *a)
return q->len < q->limit || (q->state & Qclosed);
}
-ulong noblockcnt;
-
/*
* add a block to a queue obeying flow control
*/
@@ -1191,16 +1189,19 @@ qbwrite(Queue *q, Block *b)
error(q->err);
}
- /* if nonblocking, don't queue over the limit */
+ /* don't queue over the limit */
if(q->len >= q->limit){
if(q->noblock){
iunlock(q);
freeb(b);
- noblockcnt += n;
qunlock(&q->wlock);
poperror();
return n;
}
+ if(q->len >= q->limit*2){
+ iunlock(q);
+ error(Egreg);
+ }
}
/* queue the block */