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
This commit is contained in:
Nicolas Pennequin 2008-05-13 20:51:06 +00:00
parent b9b50d9782
commit f7e0e6bb1c

View File

@ -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;