Commit graph

10 commits

Author SHA1 Message Date
Elliott Hughes
b676aafad0 Remove unnecessary #includes.
Change-Id: Ie7e0c9ea03f35517c7dcf09fc808c12e55262bc1
2014-04-10 17:50:06 -07:00
Elliott Hughes
39b644a0e2 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
2014-03-04 10:55:39 -08:00
Elliott Hughes
0e714a5b41 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
2014-03-04 10:27:58 -08:00
Elliott Hughes
9e79af3b61 Small style cleanup.
Change-Id: Ib45a4a2296232968296f9bd7cc3592ba46fd412d
2013-12-18 10:05:42 -08:00
Elliott Hughes
611b903ca7 Merge "Properly detect timeout in pthread_mutex_lock_timeout_np_impl" 2013-12-18 17:56:22 +00:00
Ken Mixter
4fae14f333 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
2013-12-17 14:26:01 -08:00
Elliott Hughes
dff7203ee9 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
2013-12-11 14:54:00 -08:00
Elliott Hughes
36d6188f8c 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
2013-11-19 14:08:54 -08:00
Elliott Hughes
66759d6041 Move the pthread debugging flags to the right place.
Change-Id: Ie805bd837d1f72cdf1818e056c0baeb0857e4e84
2013-10-31 14:09:39 -07:00
Elliott Hughes
c3f114037d <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
2013-10-31 12:31:16 -07:00
Renamed from libc/bionic/pthread.c (Browse further)