qio: naive fixing attempt on issue #64
This commit is contained in:
parent
d1dcdf2df3
commit
b222c16a38
|
@ -1156,8 +1156,6 @@ qnotfull(void *a)
|
||||||
return q->len < q->limit || (q->state & Qclosed);
|
return q->len < q->limit || (q->state & Qclosed);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong noblockcnt;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a block to a queue obeying flow control
|
* add a block to a queue obeying flow control
|
||||||
*/
|
*/
|
||||||
|
@ -1191,16 +1189,19 @@ qbwrite(Queue *q, Block *b)
|
||||||
error(q->err);
|
error(q->err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if nonblocking, don't queue over the limit */
|
/* don't queue over the limit */
|
||||||
if(q->len >= q->limit){
|
if(q->len >= q->limit){
|
||||||
if(q->noblock){
|
if(q->noblock){
|
||||||
iunlock(q);
|
iunlock(q);
|
||||||
freeb(b);
|
freeb(b);
|
||||||
noblockcnt += n;
|
|
||||||
qunlock(&q->wlock);
|
qunlock(&q->wlock);
|
||||||
poperror();
|
poperror();
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
if(q->len >= q->limit*2){
|
||||||
|
iunlock(q);
|
||||||
|
error(Egreg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* queue the block */
|
/* queue the block */
|
||||||
|
|
Loading…
Reference in a new issue