From 50c727ce7a0064d9c56bc5a963f3fb1f32726276 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 12 Feb 2011 12:33:43 +0000 Subject: 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 --- apps/buffering.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'apps/buffering.c') 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; } -- cgit