mirror of git://sourceware.org/git/glibc.git
malloc: Hoist common unlock out of if-else control block
We currently unlock the arena mutex in arena_get_retry() unconditionally. Therefore, hoist out the unlock from the if-else control block. Signed-off-by: Dev Jain <dev.jain@arm.com> Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
parent
855a67c3cc
commit
f807e85c31
|
|
@ -861,15 +861,14 @@ static mstate
|
||||||
arena_get_retry (mstate ar_ptr, size_t bytes)
|
arena_get_retry (mstate ar_ptr, size_t bytes)
|
||||||
{
|
{
|
||||||
LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
|
LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
|
||||||
|
__libc_lock_unlock (ar_ptr->mutex);
|
||||||
if (ar_ptr != &main_arena)
|
if (ar_ptr != &main_arena)
|
||||||
{
|
{
|
||||||
__libc_lock_unlock (ar_ptr->mutex);
|
|
||||||
ar_ptr = &main_arena;
|
ar_ptr = &main_arena;
|
||||||
__libc_lock_lock (ar_ptr->mutex);
|
__libc_lock_lock (ar_ptr->mutex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__libc_lock_unlock (ar_ptr->mutex);
|
|
||||||
ar_ptr = arena_get2 (bytes, ar_ptr);
|
ar_ptr = arena_get2 (bytes, ar_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue