summaryrefslogtreecommitdiffstats
path: root/apps/buffering.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2008-05-13 20:51:06 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2008-05-13 20:51:06 +0000
commitf7e0e6bb1cfc079cfbf18ce3224442be26ba46f2 (patch)
tree4d6a775b5a4834423327aaed01dc1b71a53edb25 /apps/buffering.c
parentb9b50d9782db270551de3ad00fd2e56441150dbc (diff)
downloadrockbox-f7e0e6bb1cfc079cfbf18ce3224442be26ba46f2.tar.gz
rockbox-f7e0e6bb1cfc079cfbf18ce3224442be26ba46f2.tar.bz2
rockbox-f7e0e6bb1cfc079cfbf18ce3224442be26ba46f2.zip
Lock the linked list mutex when accessing the memory handles. This should fix the invalid values appearing for short times in the buffering debug screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17497 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/buffering.c')
-rw-r--r--apps/buffering.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 84a6fca3d6..e2057d17ab 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -522,6 +522,8 @@ static void update_data_counters(void)
size_t remaining = 0;
size_t useful = 0;
+ mutex_lock(&llist_mutex);
+
m = first_handle;
while (m) {
buffered += m->available;
@@ -537,6 +539,8 @@ static void update_data_counters(void)
m = m->next;
}
+ mutex_unlock(&llist_mutex);
+
data_counters.buffered = buffered;
data_counters.wasted = wasted;
data_counters.remaining = remaining;