History log of /bionic/libc/bionic/pthread_mutex.cpp
Revision Date Author Comments
1543fdf616ddebee7819214437527f380e5c743b 08-Oct-2014 Elliott Hughes <enh@google.com> Work around a bug in Immersion's libImmEmulatorJ.so.

This library calls pthread_mutex_lock and pthread_mutex_unlock with a NULL
pthread_mutex_t*. This gives them (and their users) one release to fix things.

Bug: 17443936

(cherry picked from commit 7d3f553f989f830976efa92ddc3c84661d4d42aa)

Change-Id: Ie26bbecd3a74d61113b51c18832872499b97ee86
(cherry picked from commit b5e7eba6d1b97e471996fcfe7dbde7cbba7512ef)
b5e7eba6d1b97e471996fcfe7dbde7cbba7512ef 08-Oct-2014 Elliott Hughes <enh@google.com> Work around a bug in Immersion's libImmEmulatorJ.so.

This library calls pthread_mutex_lock and pthread_mutex_unlock with a NULL
pthread_mutex_t*. This gives them (and their users) one release to fix things.

Bug: 17443936

(cherry picked from commit 7d3f553f989f830976efa92ddc3c84661d4d42aa)

Change-Id: Ie26bbecd3a74d61113b51c18832872499b97ee86
26c1420fbb68916d66a8621b5efe8bb25cfdad7b 30-Jul-2014 Elliott Hughes <enh@google.com> Revert "Added a bionic systrace class and tracing to pthread_mutex.cpp."

This reverts commit a09fe118b1a5eb876ddaa2620965c4a8fb8b007c.

Change-Id: Ia2eb07b57a25dc2ac76fecc0925efb2bed998156
a09fe118b1a5eb876ddaa2620965c4a8fb8b007c 22-Jul-2014 Brigid Smith <brigidsmith@google.com> Added a bionic systrace class and tracing to pthread_mutex.cpp.

bionic_systrace.h contains an implementation of tracing that
can be used with systrace.py and its associated viewer. pthread_mutex
now uses this tracing to track pthread_mutex contention, which can be
enabled by using the "bionic" command line option to systrace.

Bug: 15116468

(cherry picked from commit a406ee6d5f616192e9a13afad6ac6a9969814fc1)

Change-Id: Ic98fc303689fe9384974150d0d258c50806a55e4
624996026b844ff2eba2283f4dc83ec363d85a11 29-May-2014 Elliott Hughes <enh@google.com> Minor style cleanup of some code I had to look at.

(It turns out that this is the only place we're saying __inline in C++.)

Change-Id: I8095e67a385087817c47caab9a621f82f8e0cfc8
ff03a7aaade5826e3708f6e320d0612d4cdbdb72 28-May-2014 Brigid Smith <brigidsmith@google.com> Updated ambiguous comment in pthread_mutex_lock.

The comment used the phrase "normal case" when it more specifically refers to the "recursive case," so I changed it to that.

Change-Id: I8335cce4dee933c6a463aee653b28bd986b5b5e4
2ea60ff0b415ad5b135f498a38c4b56ea75215aa 22-May-2014 Elliott Hughes <enh@google.com> Remove unnecessary #includes of <sys/atomics.h>.

Bug: 14903517
Change-Id: I7b5bcebe58774a441da986cc02376dd88e00ea0e
07f1ded1399805fa9367f4db2936832b0c22b7a5 14-May-2014 Elliott Hughes <enh@google.com> Remove the broken pthread deadlock prediction.

This hasn't built in over one release cycle and no one even noticed.
art does this the right way and other projects should do the same.

Change-Id: I7d1fb84c4080e008f329ee73e209ce85a36e6d55
b676aafad04f88e36658d4468054375158dbd3c1 11-Apr-2014 Elliott Hughes <enh@google.com> Remove unnecessary #includes.

Change-Id: Ie7e0c9ea03f35517c7dcf09fc808c12e55262bc1
39b644a0e270df453c53d6060cd364391bb1c512 04-Mar-2014 Elliott Hughes <enh@google.com> Remove dead NULL checks from pthread code.

GCC is removing these checks anyway because it knows the arguments
must be non-null, so leaving this code around is just confusing.

We know from experience that people were shipping code with locking
bugs because they weren't checking for error returns. Failing hard
like glibc does seems the better choice. (And it's what the checked
in code was already doing; this patch doesn't change that. It just
makes it more obvious that that's what's going on.)

Change-Id: I167c6d7c0a296822baf0cb9b43b97821eba7ab35
0e714a5b41451e84c5ded93a42c9a4b0a9440691 04-Mar-2014 Elliott Hughes <enh@google.com> Implement POSIX pthread_mutex_timedlock.

This replaces the non-standard pthread_mutex_lock_timeout_np, which we have
to keep around on LP32 for binary compatibility.

Change-Id: I098dc7cd38369f0c1bec1fac35687fbd27392e00
9e79af3b61b5a617c537862ebe72248beff58f19 18-Dec-2013 Elliott Hughes <enh@google.com> Small style cleanup.

Change-Id: Ib45a4a2296232968296f9bd7cc3592ba46fd412d
4fae14f3335375714be3104742fa69fe65b02001 17-Dec-2013 Ken Mixter <kmixter@google.com> Properly detect timeout in pthread_mutex_lock_timeout_np_impl

Previously we were checking against a positive errno which
would not be returned from a system call.

Change-Id: I8e3a36f6fbf5ccc2191a152a1def37e2d6f93124
dff7203ee99ccac446b9a1c4371753a5216c6db4 11-Dec-2013 Elliott Hughes <enh@google.com> Remove harmful attempts to be helpful in pthread_mutex functions.

Most callers won't check for EINVAL, so it's best to fail early.
GCC takes the nonnull attribute as a guarantee that an argument
won't be NULL, so these hacks were already ineffective, which is
how we found that at least one commercial game was using NULL
as if it's a mutex, but actually getting no-op behavior.

Bug: 11971278
Change-Id: I89646e043d931778805a8b692e07a34d076ee6bf
36d6188f8cd8b948fb797f11d9620d63d0c2215a 19-Nov-2013 Elliott Hughes <enh@google.com> Clean up forking and cloning.

The kernel now maintains the pthread_internal_t::tid field for us,
and __clone was only used in one place so let's inline it so we don't
have to leave such a dangerous function lying around. Also rename
files to match their content and remove some useless #includes.

Change-Id: I24299fb4a940e394de75f864ee36fdabbd9438f9
66759d6041b33706c3a92dde48492ba4f2bbab2f 31-Oct-2013 Elliott Hughes <enh@google.com> Move the pthread debugging flags to the right place.

Change-Id: Ie805bd837d1f72cdf1818e056c0baeb0857e4e84
c3f114037dbf028896310609fd28cf2b3da99c4d 30-Oct-2013 Elliott Hughes <enh@google.com> <pthread.h> fixes and pthread cleanup.

<pthread.h> was missing nonnull attributes, noreturn on pthread_exit,
and had incorrect cv qualifiers for several standard functions.

I've also marked the non-standard stuff (where I count glibc rather
than POSIX as "standard") so we can revisit this cruft for LP64 and
try to ensure we're compatible with glibc.

I've also broken out the pthread_cond* functions into a new file.

I've made the remaining pthread files (plus ptrace) part of the bionic code
and fixed all the warnings.

I've added a few more smoke tests for chunks of untested pthread functionality.

We no longer need the libc_static_common_src_files hack for any of the
pthread implementation because we long since stripped out the rest of
the armv5 support, and this hack was just to ensure that __get_tls in libc.a
went via the kernel if necessary.

This patch also finishes the job of breaking up the pthread.c monolith, and
adds a handful of new tests.

Change-Id: Idc0ae7f5d8aa65989598acd4c01a874fe21582c7