summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/buffering.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 655e5cfdaf..c59fc52b8a 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -1006,7 +1006,11 @@ static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
1006 do 1006 do
1007 { 1007 {
1008 sleep(1); 1008 sleep(1);
1009 /* it is not safe for a non-buffering thread to sleep while
1010 * holding a handle */
1009 h = find_handle(handle_id); 1011 h = find_handle(handle_id);
1012 if (!h)
1013 return NULL;
1010 avail = RINGBUF_SUB(h->widx, h->ridx); 1014 avail = RINGBUF_SUB(h->widx, h->ridx);
1011 } 1015 }
1012 while (h->filerem > 0 && avail < *size); 1016 while (h->filerem > 0 && avail < *size);