From 551db40abb4c9c1664c291bc431c4a3f55e530c7 Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Thu, 8 Nov 2007 16:06:24 +0000 Subject: Clean up a (nearly impossible) null check. Add a comment. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15536 a1c6a512-1295-4272-9138-f99709370657 --- apps/buffering.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/buffering.c') 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, do { sleep(1); + /* it is not safe for a non-buffering thread to sleep while + * holding a handle */ h = find_handle(handle_id); + if (!h) + return NULL; avail = RINGBUF_SUB(h->widx, h->ridx); } while (h->filerem > 0 && avail < *size); -- cgit v1.2.3