This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code
- From: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- To: fweimer at redhat dot com
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 20 Aug 2016 16:36:10 +0200
- Subject: Re: Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code
- Authentication-results: sourceware.org; auth=none
Hello,
In 400e12265d99964f8445bb6d717321eb73152cc5 ('Replace MUTEX_INITIALIZER
with _LIBC_LOCK_INITIALIZER in generic code'),
--- b/sysdeps/generic/malloc-machine.h
-# define MUTEX_INITIALIZER (0)
--- a/sysdeps/nptl/malloc-machine.h
-#define MUTEX_INITIALIZER LLL_LOCK_INITIALIZER
-static mutex_t list_lock = MUTEX_INITIALIZER;
+static mutex_t list_lock = _LIBC_LOCK_INITIALIZER;
...
Why not keeping MUTEX_INITIALIZER? There is not only nptl and generic
ports of glibc, other ports may not be using libc_lock to implement
malloc's mutex...
And anyway, either malloc should be made to just use libc-lock or lll
explicitly, or the malloc-machine.h layer should be providing a complete
interface and users shouldn't be assuming anything about it.
Samuel