mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 16:21:06 +00:00
(ptmalloc_unlock_all2): Don't add (void) to mutex_init calls. (arena_get2): Don't look at return value of mutex_lock.
This commit is contained in:
parent
6161ef14c3
commit
fdb933e255
@ -1,5 +1,5 @@
|
|||||||
/* Malloc implementation for multiple threads without lock contention.
|
/* Malloc implementation for multiple threads without lock contention.
|
||||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
|
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
|
||||||
|
|
||||||
@ -275,11 +275,11 @@ ptmalloc_unlock_all2 __MALLOC_P((void))
|
|||||||
__free_hook = save_free_hook;
|
__free_hook = save_free_hook;
|
||||||
#endif
|
#endif
|
||||||
for(ar_ptr = &main_arena;;) {
|
for(ar_ptr = &main_arena;;) {
|
||||||
(void)mutex_init(&ar_ptr->mutex);
|
mutex_init(&ar_ptr->mutex);
|
||||||
ar_ptr = ar_ptr->next;
|
ar_ptr = ar_ptr->next;
|
||||||
if(ar_ptr == &main_arena) break;
|
if(ar_ptr == &main_arena) break;
|
||||||
}
|
}
|
||||||
(void)mutex_init(&list_lock);
|
mutex_init(&list_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -711,7 +711,6 @@ arena_get2(a_tsd, size) mstate a_tsd; size_t size;
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mstate a;
|
mstate a;
|
||||||
int err;
|
|
||||||
|
|
||||||
if(!a_tsd)
|
if(!a_tsd)
|
||||||
a = a_tsd = &main_arena;
|
a = a_tsd = &main_arena;
|
||||||
@ -753,7 +752,7 @@ arena_get2(a_tsd, size) mstate a_tsd; size_t size;
|
|||||||
|
|
||||||
tsd_setspecific(arena_key, (Void_t *)a);
|
tsd_setspecific(arena_key, (Void_t *)a);
|
||||||
mutex_init(&a->mutex);
|
mutex_init(&a->mutex);
|
||||||
err = mutex_lock(&a->mutex); /* remember result */
|
mutex_lock(&a->mutex); /* remember result */
|
||||||
|
|
||||||
/* Add the new arena to the global list. */
|
/* Add the new arena to the global list. */
|
||||||
(void)mutex_lock(&list_lock);
|
(void)mutex_lock(&list_lock);
|
||||||
@ -761,9 +760,6 @@ arena_get2(a_tsd, size) mstate a_tsd; size_t size;
|
|||||||
main_arena.next = a;
|
main_arena.next = a;
|
||||||
(void)mutex_unlock(&list_lock);
|
(void)mutex_unlock(&list_lock);
|
||||||
|
|
||||||
if(err) /* locking failed; keep arena for further attempts later */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
THREAD_STAT(++(a->stat_lock_loop));
|
THREAD_STAT(++(a->stat_lock_loop));
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user