summaryrefslogtreecommitdiffstats
path: root/runtime/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/stream.c')
-rw-r--r--runtime/stream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/stream.c b/runtime/stream.c
index 88606db7..e2f6623e 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -863,7 +863,8 @@ doAsyncWriteInternal(strm_t *pThis, size_t lenBuf)
DEFiRet;
ISOBJ_TYPE_assert(pThis, strm);
- while(pThis->iCnt >= STREAM_ASYNC_NUMBUFS)
+ /* the -1 below is important, because we need one buffer for the main thread! */
+ while(pThis->iCnt >= STREAM_ASYNC_NUMBUFS - 1)
d_pthread_cond_wait(&pThis->notFull, &pThis->mut);
pThis->asyncBuf[pThis->iEnq % STREAM_ASYNC_NUMBUFS].lenBuf = lenBuf;