mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code
* sysdeps/mach/hurd/libc-lock.h (_LIBC_LOCK_INITIALIZER): Define. (__libc_lock_define_initialized): Use it. * sysdeps/nptl/libc-lockP.h (_LIBC_LOCK_INITIALIZER): Define. * malloc/arena.c (list_lock): Use _LIBC_LOCK_INITIALIZER. * malloc/malloc.c (main_arena): Likewise. * sysdeps/generic/malloc-machine.h (MUTEX_INITIALIZER): Remove. * sysdeps/nptl/malloc-machine.h (MUTEX_INITIALIZER): Remove.
This commit is contained in:
parent
a61a1a2576
commit
400e12265d
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2015-11-24 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code.
|
||||||
|
* sysdeps/mach/hurd/libc-lock.h (_LIBC_LOCK_INITIALIZER): Define.
|
||||||
|
(__libc_lock_define_initialized): Use it.
|
||||||
|
* sysdeps/nptl/libc-lockP.h (_LIBC_LOCK_INITIALIZER): Define.
|
||||||
|
* malloc/arena.c (list_lock): Use _LIBC_LOCK_INITIALIZER.
|
||||||
|
* malloc/malloc.c (main_arena): Likewise.
|
||||||
|
* sysdeps/generic/malloc-machine.h (MUTEX_INITIALIZER): Remove.
|
||||||
|
* sysdeps/nptl/malloc-machine.h (MUTEX_INITIALIZER): Remove.
|
||||||
|
|
||||||
2015-11-23 Joseph Myers <joseph@codesourcery.com>
|
2015-11-23 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
|
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
|
||||||
|
@ -73,7 +73,7 @@ static __thread mstate thread_arena attribute_tls_model_ie;
|
|||||||
objects. No other (malloc) locks must be taken while list_lock is
|
objects. No other (malloc) locks must be taken while list_lock is
|
||||||
active, otherwise deadlocks may occur. */
|
active, otherwise deadlocks may occur. */
|
||||||
|
|
||||||
static mutex_t list_lock = MUTEX_INITIALIZER;
|
static mutex_t list_lock = _LIBC_LOCK_INITIALIZER;
|
||||||
static size_t narenas = 1;
|
static size_t narenas = 1;
|
||||||
static mstate free_list;
|
static mstate free_list;
|
||||||
|
|
||||||
|
@ -1760,7 +1760,7 @@ struct malloc_par
|
|||||||
|
|
||||||
static struct malloc_state main_arena =
|
static struct malloc_state main_arena =
|
||||||
{
|
{
|
||||||
.mutex = MUTEX_INITIALIZER,
|
.mutex = _LIBC_LOCK_INITIALIZER,
|
||||||
.next = &main_arena,
|
.next = &main_arena,
|
||||||
.attached_threads = 1
|
.attached_threads = 1
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,6 @@ typedef int mutex_t;
|
|||||||
# define mutex_lock(m) ({ *(m) = 1; 0; })
|
# define mutex_lock(m) ({ *(m) = 1; 0; })
|
||||||
# define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
|
# define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
|
||||||
# define mutex_unlock(m) (*(m) = 0)
|
# define mutex_unlock(m) (*(m) = 0)
|
||||||
# define MUTEX_INITIALIZER (0)
|
|
||||||
|
|
||||||
#endif /* !defined mutex_init */
|
#endif /* !defined mutex_init */
|
||||||
|
|
||||||
|
@ -50,8 +50,9 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
|
|||||||
CLASS __libc_lock_t NAME;
|
CLASS __libc_lock_t NAME;
|
||||||
|
|
||||||
/* Define an initialized lock variable NAME with storage class CLASS. */
|
/* Define an initialized lock variable NAME with storage class CLASS. */
|
||||||
|
#define _LIBC_LOCK_INITIALIZER MUTEX_INITIALIZER
|
||||||
#define __libc_lock_define_initialized(CLASS,NAME) \
|
#define __libc_lock_define_initialized(CLASS,NAME) \
|
||||||
CLASS __libc_lock_t NAME = MUTEX_INITIALIZER;
|
CLASS __libc_lock_t NAME = _LIBC_LOCK_INITIALIZER;
|
||||||
|
|
||||||
/* Initialize the named lock variable, leaving it in a consistent, unlocked
|
/* Initialize the named lock variable, leaving it in a consistent, unlocked
|
||||||
state. */
|
state. */
|
||||||
|
@ -75,6 +75,7 @@ typedef pthread_key_t __libc_key_t;
|
|||||||
initialized locks must be set to one due to the lack of normal
|
initialized locks must be set to one due to the lack of normal
|
||||||
atomic operations.) */
|
atomic operations.) */
|
||||||
|
|
||||||
|
#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
|
||||||
#if IS_IN (libc) || IS_IN (libpthread)
|
#if IS_IN (libc) || IS_IN (libpthread)
|
||||||
# if LLL_LOCK_INITIALIZER == 0
|
# if LLL_LOCK_INITIALIZER == 0
|
||||||
# define __libc_lock_define_initialized(CLASS,NAME) \
|
# define __libc_lock_define_initialized(CLASS,NAME) \
|
||||||
|
@ -31,7 +31,6 @@ __libc_lock_define (typedef, mutex_t)
|
|||||||
#define mutex_lock(m) __libc_lock_lock (*(m))
|
#define mutex_lock(m) __libc_lock_lock (*(m))
|
||||||
#define mutex_trylock(m) __libc_lock_trylock (*(m))
|
#define mutex_trylock(m) __libc_lock_trylock (*(m))
|
||||||
#define mutex_unlock(m) __libc_lock_unlock (*(m))
|
#define mutex_unlock(m) __libc_lock_unlock (*(m))
|
||||||
#define MUTEX_INITIALIZER LLL_LOCK_INITIALIZER
|
|
||||||
|
|
||||||
/* This is defined by newer gcc version unique for each module. */
|
/* This is defined by newer gcc version unique for each module. */
|
||||||
extern void *__dso_handle __attribute__ ((__weak__));
|
extern void *__dso_handle __attribute__ ((__weak__));
|
||||||
|
Loading…
Reference in New Issue
Block a user