summaryrefslogtreecommitdiffstats
path: root/apps/buffering.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-02-12 12:33:43 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-02-12 12:33:43 +0000
commit50c727ce7a0064d9c56bc5a963f3fb1f32726276 (patch)
treec9686f27f0500f84084be2d281ee4b3b0fb0953c /apps/buffering.c
parent3c81bf0c136a93751abde073dcaebf1a998f1303 (diff)
downloadrockbox-50c727ce7a0064d9c56bc5a963f3fb1f32726276.tar.gz
rockbox-50c727ce7a0064d9c56bc5a963f3fb1f32726276.tar.bz2
rockbox-50c727ce7a0064d9c56bc5a963f3fb1f32726276.zip
Oops. Put back some changes to go only with others.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29289 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/buffering.c')
-rw-r--r--apps/buffering.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 9bc5abd963..48ef1bc6c0 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -450,6 +450,9 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
return false;
}
+ mutex_lock(&llist_mutex);
+ mutex_lock(&llist_mod_mutex);
+
oldpos = ringbuf_offset(src);
newpos = ringbuf_add(oldpos, final_delta);
overlap = ringbuf_add_cross(newpos, size_to_move, buffer_len);
@@ -475,6 +478,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
correction = (correction + 3) & ~3;
if (final_delta < correction + sizeof(struct memory_handle)) {
/* Delta cannot end up less than the size of the struct */
+ mutex_unlock(&llist_mod_mutex);
+ mutex_unlock(&llist_mutex);
return false;
}
newpos -= correction;
@@ -496,6 +501,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
if (m && m->next == src) {
m->next = dest;
} else {
+ mutex_unlock(&llist_mod_mutex);
+ mutex_unlock(&llist_mutex);
return false;
}
}
@@ -556,6 +563,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
/* Update the caller with the new location of h and the distance moved */
*h = dest;
*delta = final_delta;
+ mutex_unlock(&llist_mod_mutex);
+ mutex_unlock(&llist_mutex);
return true;
}