History log of /bionic/tools/versioner/current/pthread.h
Revision Date Author Comments
c2ce12046c74613da2c41e1cce876db6ce81d4a9 22-Jun-2017 Dan Albert <danalbert@google.com> Put back more legacy pthread APIs.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/423
Bug: https://stackoverflow.com/q/44580542/632035
Change-Id: Ibf52a969afffbfcdf6793a0bf8b0e10bbdd1f32c
8c67f1e617357cad075874598702bf9a9c8e8200 12-Jun-2017 Dan Albert <danalbert@google.com> Expose pthread_mutex_lock_timeout_np to the NDK.

The proper API for this isn't available until L, so expose this for
API levels earlier than that.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/420
Change-Id: I382b8f557be9530f3e13aaae353b4a6e7f9301ab
cfb61712c4367c2943f1b4fb7838d5e125020bef 20-Apr-2017 Josh Gao <jmgao@google.com> The future is now.

__INTRODUCED_IN_FUTURE -> __INTRODUCED_IN(26)

Bug: http://b/37437368
Test: treehugger
Change-Id: I601a23da83b65a0cd582cc840ed3856a9031b673
(cherry picked from commit cb302f932a3532f1484e1e70894e9b1199384283)

(Cherry picked a DO N*T MERGE commit that should have been merged)
(cherry picked from commit 2e8e5e60b6ecbcfe2110242e41b9ec5340b11cf5)
2e8e5e60b6ecbcfe2110242e41b9ec5340b11cf5 20-Apr-2017 Josh Gao <jmgao@google.com> DO NOT MERGE: The future is now.

__INTRODUCED_IN_FUTURE -> __INTRODUCED_IN(26)

Bug: http://b/37437368
Test: treehugger
Change-Id: I601a23da83b65a0cd582cc840ed3856a9031b673
(cherry picked from commit cb302f932a3532f1484e1e70894e9b1199384283)
cb302f932a3532f1484e1e70894e9b1199384283 20-Apr-2017 Josh Gao <jmgao@google.com> The future is now.

__INTRODUCED_IN_FUTURE -> __INTRODUCED_IN(26)

Bug: http://b/37437368
Test: treehugger
Change-Id: I601a23da83b65a0cd582cc840ed3856a9031b673
468a5d2d83a3d719f7493d041abc69587756d8fa 21-Mar-2017 Elliott Hughes <enh@google.com> pthread barrier and spinlock types should only appear at API level 24.

Bug: https://github.com/android-ndk/ndk/issues/336
Test: builds
Change-Id: I938d9d7ea879d1dbc355f14e100f1ea31a51a1f0
95fa061678400315ee757758bf5f9146176d47a0 28-Sep-2016 Elliott Hughes <enh@google.com> Rename __pure, __pure2, and __purefunc.

These names were pretty misleading (aka "backwards"), so switch to the
same obvious names glibc uses.

Test: build.
Change-Id: Ia98c9dbbccd0820386116562347654e84669034a
280236537e06c7accaffabf8fb407f93dd1c834f 12-Aug-2016 Elliott Hughes <enh@google.com> POSIX says <sys/types.h> should make all the pthread_* types available.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Change-Id: I606194e15ceaa3129f266a9a460c358eaa8bf686
02ac028bf7899f293a39e991f346fd35e2910949 12-Aug-2016 Elliott Hughes <enh@google.com> Fix pthread_barrierattr_getpshared prototype.

As http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_getpshared.html
is my witness, there's a missing `const` here.

Change-Id: Ifd68188fb952460b64d144bdc21a53bc40ed82a7
5470c183611737af5ec954984e4bdb5da8c99b73 22-Jul-2016 Elliott Hughes <enh@google.com> Make it possible to build bionic with -I instead of -isystem.

Various things:

* work around -Wnullability-completeness.
* use C++ casts in C++ and C casts in C.
* stop using attributes clang doesn't support (such as `warning`).
* remove duplicate definitions of XATTR_CREATE and XATTR_REPLACE.

Change-Id: I07649e46275b28a23ca477deea119fe843999533
46b44160e9e4c466be0faf1bb8d6ec70ecc83273 27-May-2016 Josh Gao <jmgao@google.com> Update header versions for NDK platform fixes.

Bug: http://b/28178111
Change-Id: Icd638673b409aa43a91490f77c6b4d79c9ea20d9
e2f25831eba8dcbb57aebbf50c463d4473c7df30 09-May-2016 Elliott Hughes <enh@google.com> Remove declaration of pthread_cond_timedwait_relative_np.

It's been deprecated long enough, and nothing left in the tree (except
code that isn't even built) is still using it.

Bug: http://b/27918161
Change-Id: Ibf824c1063d49484037de5c03b98bec5bdd4dcf6
3164ab733ccdcd5c900d0f1ed1a0dbbb11ad61a2 07-May-2016 Elliott Hughes <enh@google.com> Remove pthread_mutex_lock_timeout_np from <pthread.h>.

It's been deprecated long enough, and nothing left in the tree (except
code that isn't even built) is still using it.

Bug: http://b/27918161
Change-Id: I1786f5e2528a23c17b3f7298f4ba5fc7761a26c5
baa2a973bd776a51bb05a8590ab05d86eea7b321 14-Aug-2015 Dan Albert <danalbert@google.com> Use clang's nullability instead of nonnull.

http://clang.llvm.org/docs/AttributeReference.html#nonnull

_Nonnull is similar to the nonnull attribute in that it will instruct
compilers to warn the user if it can prove that a null argument is
being passed. Unlike the nonnull attribute, this annotation indicated
that a value *should not* be null, not that it *cannot* be null, or
even that the behavior is undefined. The important distinction is that
the optimizer will perform surprising optimizations like the
following:

void foo(void*) __attribute__(nonnull, 1);

int bar(int* p) {
foo(p);

// The following null check will be elided because nonnull
// attribute means that, since we call foo with p, p can be
// assumed to not be null. Thus this will crash if we are called
// with a null pointer.
if (src != NULL) {
return *p;
}
return 0;
}

int main() {
return bar(NULL);
}

Note that by doing this we are no longer attaching any sort of
attribute for GCC (GCC doesn't support attaching nonnull directly to a
parameter, only to the function and naming the arguments
positionally). This means we won't be getting a warning for this case
from GCC any more. People that listen to warnings tend to use clang
anyway, and we're quickly moving toward that as the default, so this
seems to be an acceptable tradeoff.

Change-Id: Ie05fe7cec2f19a082c1defb303f82bcf9241b88d
34c599a8b0b04f66b065c4d84b809f74dd44382d 29-Apr-2016 Josh Gao <jmgao@google.com> Add __INTRODUCED_IN_FUTURE for unreleased APIs.

Future API levels aren't known (e.g. 25 could be a maintenance release
of N that doesn't contain any bionic updates), so use a placeholder
macro that we can find and replace with the actual API level before each
release.

Bug: http://b/28178111
Change-Id: I667fe53ea1ac49b64135170fc30d5dbe9df94e29
14adff1cfa06a3d4d3281a9bf7848b556d84c20d 29-Apr-2016 Josh Gao <jmgao@google.com> Add versioning information to symbols.

Bug: http://b/28178111
Change-Id: I46bf95accd819f4521afb1173d8badcc5e9df31c
3615a521265271acb02c30e2ab021969852b77c8 28-Apr-2016 Elliott Hughes <enh@google.com> Remove declaration of pthread_cond_timeout_np.

Bug: http://b/27918161
Change-Id: I61b5710dc394c155bdb4577a750b96195033251e
96583dcf95ba51c3ac51ef65c2172be1b2696431 30-Mar-2016 Elliott Hughes <enh@google.com> Stop defining HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE.

Bug: http://b/27918161
Change-Id: I21d4dfa4636aa06a93b3c8a215113f66f37f0bc7
cc78b252d113229f44550b1158f0fc67439d0184 24-Mar-2016 Elliott Hughes <enh@google.com> Remove the __USE_GNU guard from pthread_setname_np again.

Caused build breakage, but not spotted by TreeHugger:

external/libnfc-nxp/Linux_x86/phDal4Nfc.c:737:5: error: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
pthread_setname_np(pthread_self(), "reader");
^

Nice file name.

Change-Id: I102e55718babf4e4f2f2c64066c6a83ed3ac86d3
725b2a96a70c6570a1fb84562fe46348414752cd 23-Mar-2016 Elliott Hughes <enh@google.com> Add pthread_getname_np.

Also guard both these GNU extensions with _GNU_SOURCE.

Also improve the tests to test each case on both the current thread and
another thread, since the code paths are totally different.

Bug: http://b/27810459
Change-Id: I72b05bca5c5b6ca8ba4585b8edfb716a1c252f92
5704c423c81790195161c1757ae79da188590c51 26-Jan-2016 Elliott Hughes <enh@google.com> Implement POSIX lockf.

This has been requested a few times over the years. This is basically
a very late rebase of https://android-review.googlesource.com/45470
which was abandoned years ago. One addition is that this version has
_FILE_OFFSET_BITS=64 support.

POSIX puts this in <unistd.h>. glibc also has it in <fcntl.h>.

Bug: http://b/13077650
Change-Id: I5862b1dc326e326c01ad92438ecc1578d19ba739
fe3a83a9343f0e4ff654f09ef8ffc8a773c7c105 18-Nov-2015 Yabin Cui <yabinc@google.com> Implement pthread spin.

In order to run tsan unit tests, we need to support pthread spin APIs.

Bug: 18623621
Bug: 25392375
Change-Id: Icbb4a74e72e467824b3715982a01600031868e29
e7c2fffa16eccecfd43d99516751a43776f5f609 06-Nov-2015 Yabin Cui <yabinc@google.com> Implement pthread barrier.

Bug: 24341262
Change-Id: I5472549e5d7545c1c3f0bef78235f545557b9630
2b028f5ce47b8d27ca6d3b86e135f7d9b0359547 23-Jun-2015 Elliott Hughes <enh@google.com> Fix bad merge of 64e9e71cdb7d88397e510e1986d494b797ed3b45.

Bug: http://b/22029751
Change-Id: I6245fe5f274c9af8a632da5eebe50cf9fe29dc4a
64e9e71cdb7d88397e510e1986d494b797ed3b45 12-Jun-2015 Sharvil Nanavati <sharvil@google.com> Define nonportable pthread mutex macros with the _NP suffix.

Change-Id: I1066352e5b2607f64daf6aeb0030d0bbe88ead8d
60907c7f4ec788def8741e4efb933eafb6560eaa 10-Jun-2015 Christopher Ferris <cferris@google.com> Allow NULL in pthread_mutex_lock/unlock.

The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
(cherry picked from commit 511cfd9dc8cb41bca4920687c7d816ee916ee8e5)

Change-Id: I159a99a941cff94297ef3fffda7075f8ef1ae252
511cfd9dc8cb41bca4920687c7d816ee916ee8e5 10-Jun-2015 Christopher Ferris <cferris@google.com> Allow NULL in pthread_mutex_lock/unlock.

The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
76615dae93c18ac890e167c547a08c0228709a33 17-Mar-2015 Yabin Cui <yabinc@google.com> Provide writer preference option in rwlock.

Previous implementation of rwlock contains four atomic variables, which
is hard to maintain and change. So I make following changes in this CL:

1. Add pending flags in rwlock.state, so we don't need to synchronize
between different atomic variables. Using compare_and_swap operations
on rwlock.state is enough for all state change.

2. Add pending_lock to protect readers/writers waiting and wake up
operations. As waiting/wakeup is not performance critical, using a
lock is easier to maintain.

3. Add writer preference option.

4. Add unit tests for rwlock.

Bug: 19109156

Change-Id: Idcaa58d695ea401d64445610b465ac5cff23ec7c
377243b78c43ffc98a6c9f145a6cd27ab99c08f0 26-Mar-2015 Yabin Cui <yabinc@google.com> Remove PTHREAD_RECURSIVE_MUTEX_INITIALIZER and PTHREAD_ERRORCHECK_MUTEX_INITIALIZER.

These macros are also not used in glibc. And we should use
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
and PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP instead.

Change-Id: I35195e2f499712dcde9305bbb93622d0f7ca874b
17393b06bab9cb3e95d0f466a56c746de19b8eee 21-Mar-2015 Yabin Cui <yabinc@google.com> Hide internal of pthread_mutex_t.

Bug: 19249079
Change-Id: Iffb79c8d861b698d474f212dc80c638fc2cf1620
b58457221364eaad039c2c49a42626b725e980d5 17-Mar-2015 Yabin Cui <yabinc@google.com> Add test for pthread types alignment check.

Bug: 19249079
Change-Id: I83c4f0d11ec5d82a346ae0057d02a92bb1d519e8
b3ac2145f4a4cab52d016601edd18f7789089e41 17-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Fix build: align pthread_cond_t to sizeof(long)

(cherry picked from commit b5cd3c7a7503d8155ea17424c00f7e77603252c0)

Change-Id: I69d8feeda2c8e0423c5626bcd40914e7eb9d85e4
b5cd3c7a7503d8155ea17424c00f7e77603252c0 17-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Fix build: align pthread_cond_t to sizeof(long)

Change-Id: Ieaee6d09089b161ec516ba22cafaee1ecb4342da
eb8b122d67db501729ecde4fcb960336c87af4ce 17-Mar-2015 Christopher Ferris <cferris@google.com> Add alignment to opaque types.

If there is no alignment forced, then the compiler might put these
structures at any alignment.

Change-Id: I6416db72433504e0ec1178bfae6f5b18b6e363fb
32651b8e8e453391c7aaca47cd885e94d54d0bf4 14-Mar-2015 Yabin Cui <yabinc@google.com> Hide content of pthread_cond_t in pthread_cond_internal_t.

Bug: 19249079
Change-Id: I6f55af30bcd6211ce71630c6cacbef0e1663dcee
2fabea47ac9475bcc52aff0715819d18aa5bdf1d 13-Mar-2015 Yabin Cui <yabinc@google.com> Hide content of pthread_rwlock_t in pthread_rwlock_internal_t.

Bug: 19249079
Change-Id: Ifbe634c716b6793bef897ec5134b55eb44c6b8d5
08ee8d2030fbc73c4c144e819dd68806b0351cbe 12-Feb-2015 Yabin Cui <yabinc@google.com> Switch pthread_rwlock_t to stdatomic.

Bug: 19099838
Change-Id: Ie82967a60b5cec61a8bdd1e0e4a03738d01944f8
e5f816c01780220880ee59a29f727c48b51365d3 29-Jan-2015 Yabin Cui <yabinc@google.com> Switch pthread_cond_t to <stdatomic.h>.

Bug: 17574458
Change-Id: Ic7f79861df4fe751cfa6c6b20b71123cc31e7114
86fc96f73311f43980df770f4ff8022f1e9b296a 30-Jan-2015 Yabin Cui <yabinc@google.com> Switch pthread_mutex_t from bionic atomics to <stdatomic.h>.

Bug: 17574456
Change-Id: I5ce3d3dc07e804e9ce55c42920f47531b56e04de
80e6d6d825df4616808b22b5639114566c27af0e 24-Jan-2015 Yabin Cui <yabinc@google.com> Switch pthread_once_t to stdatomic.h.

Bug: 17574610

Change-Id: I653f2aa4b5b38dbdaffe4a6c3deccfe6ad3b0e74
212e0e38248860b151b28877225629a988d95b58 02-Dec-2014 Elliott Hughes <enh@google.com> Build our benchmarks against glibc too.

Bug: 18556607
Change-Id: I455ac8b93c0835836180e549486bc52d393ee6a6
75ef63d6cf83787233d1c45489c4ec03b0a67d16 21-Nov-2014 Dan Albert <danalbert@google.com> Move some pthread functions to signal.h.

POSIX specifies that pthread_kill(3) and pthread_sigmask(3) are
supposed to live in signal.h rather than pthread.h.

Since signal.h now needs pthread_t and pthread_attr_t, I've moved
those defintions into include/machine/pthread_types.h to keep the
namespace clean. I also sorted some includes. The combination of these
two things seems to have exploded into a cascade of missing includes,
so this patch also cleans up all those.

Change-Id: Icfa92a39432fe83f542a797e5a113289d7e4ad0c
3d773274ad6caaf7e0431c3d5eeb31f727b53d1a 08-Oct-2014 Elliott Hughes <enh@google.com> Revert "Work around a bug in Immersion's libImmEmulatorJ.so."

This reverts commit 7d3f553f989f830976efa92ddc3c84661d4d42aa.

Change-Id: I8909b6aa1d97e9a61dbe95a2d91b9fbe336b58f0
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
7d3f553f989f830976efa92ddc3c84661d4d42aa 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
Change-Id: I3b63c9a3dd63db0833f21073e323b3236a13b47a
a4831cb4a3f44b93788488db8ff9ea76613f0355 12-Sep-2014 Elliott Hughes <enh@google.com> Add pthread_gettid_np and re-expose __get_thread for LP32.

A lot of third-party code calls the private __get_thread symbol,
often as part of a backport of bionic's pthread_rwlock implementation.
Hopefully this will go away for LP64 (since you're guaranteed the
real implementation there), but there are still APIs that take a tid
and no way to convert between a pthread_t and a tid. pthread_gettid_np
is a public API for that. To aid the transition, make __get_thread
available again for LP32.

(cherry-pick of 27efc48814b8153c55cbcd0af5d9add824816e69.)

Bug: 14079438
Change-Id: I43fabc7f1918250d31d4665ffa4ca352d0dbeac1
27efc48814b8153c55cbcd0af5d9add824816e69 12-Sep-2014 Elliott Hughes <enh@google.com> Add pthread_gettid_np and re-expose __get_thread for LP32.

A lot of third-party code calls the private __get_thread symbol,
often as part of a backport of bionic's pthread_rwlock implementation.
Hopefully this will go away for LP64 (since you're guaranteed the
real implementation there), but there are still APIs that take a tid
and no way to convert between a pthread_t and a tid. pthread_gettid_np
is a public API for that. To aid the transition, make __get_thread
available again for LP32.

Bug: 14079438
Change-Id: I43fabc7f1918250d31d4665ffa4ca352d0dbeac1
b27a840f4b520bfa095db99b0a2e5205634b0003 11-Jun-2014 Elliott Hughes <enh@google.com> Add __pure2 to a few more functions, most notably gettid and pthread_self.

Change-Id: I7eee9f26f45130038af09d8285782b07f70a996f
92687e41bcf108957944dafa80a9bfda219bfb0f 22-May-2014 Calin Juravle <calin@google.com> Cleaned up pthread rwlocks implementation.

- used underscore_style_for_vars
- extracted time related functionality into a function
- cleaned up style
- removed unused fields from pthread_rwlock_t on LP64
- changed reservation in pthread_rwlock_t so that the size of the
structure equals glibc version

Bug: 8133149

Change-Id: I84ad3918678dc7f5e6b3db9b7e9b0899d3abe9cd
76f352eec12d8938101e5ae33429c72797c3aa23 19-May-2014 Calin Juravle <calin@google.com> Mutex-free implementation of pthread_rwlock

Bug: 8133149
Change-Id: Id6775010d95f2634b173daa55d87a59a3cf4131b
ea5248ee1bc5d031e0b1e70a311f450a741c1e99 15-May-2014 Christopher Ferris <cferris@google.com> Increase minimum thread size for 64 bit.

Bug: 14468519
Change-Id: I642a5515acf5fbed46e77e176f6b5dd3b7c7bd45
7c435f2415f4cdc97fbb7739f70ae5e84f2e2cb0 06-May-2014 Calin Juravle <calin@google.com> Leave more space for extensions in pthread_rwlockattr_t

Change pthread_rwlockattr_t from int to long. On LP64 this gives us more
room for extensibility since longs are 8 bytes. glibc also reserves 8
bytes for this.

Bug: 14582681
Bug: 12875898
Change-Id: I55d599be0fdbbf0cb55957ec0ea62ab042bdee94
b1cacd42454822a4a42b68bfed32b9538210aa25 23-Apr-2014 Calin Juravle <calin@google.com> Reserve space in pthread structures for future extensibility.

Make our structures equal in size with glibc structures. This should
give us plenty of space to implement any missing feature.

Bug: 13278744
Bug: 12875898
(cherry picked from commit cf83fd77caa3128ecb6ac935e342cb0ea258b9ee)

Change-Id: I76968d31024eb51bc73887687e5ac492eb02a27f
6b64000ef0ac6e9476e5f0420b4c09844e65d51f 24-Apr-2014 Greg Hackmann <ghackmann@google.com> Revert "Reserve space in pthread structures for future extensibility."

This reverts commit cf83fd77caa3128ecb6ac935e342cb0ea258b9ee.

Change-Id: I4f69e86ffe1c267a9018eb489d909237534c6cf9
cf83fd77caa3128ecb6ac935e342cb0ea258b9ee 23-Apr-2014 Calin Juravle <calin@google.com> Reserve space in pthread structures for future extensibility.

Make our structures equal in size with glibc structures. This should
give us plenty of space to implement any missing feature.

Bug: 13278744
Bug: 12875898
Change-Id: I980017fd5942411ebc5ac32b2673a10a20db68c8
a4eafa6dbc98378f3fa759fec8590871e2b5ae29 10-Mar-2014 Calin Juravle <calin@google.com> Removed pthread_attr_getstackaddr/pthread_attr_setstackaddr

Moved existing definitions to ndk_cruft to preserve NDK compatibility.

Bug: 13281069
Change-Id: I6f260de69afa55a6274f0d13145c19ac6517b9d5
252ee1e1124ae8aef2bde0c365c9ac6d59282bc8 04-Mar-2014 Narayan Kamath <narayan@google.com> Stop defining HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC.

No code is using this definition.

Change-Id: I188db63f38d62baf1cb57d0a36fcda540ad98492
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
51e6cb33e3d7c2f44864d356a2a8e66317688f55 03-Mar-2014 Narayan Kamath <narayan@google.com> Implement pthread_condattr_{get,set}clock.

We only support CLOCK_REALTIME and CLOCK_MONOTONIC for now,
so we us a single bit from pthread_cond_t->value to denote
the clock type. Note that this reduces the width of the counter
to 30 bits, but this should be large enough for all practical
purposes.

bug: 13232338

Change-Id: I857e7da64b3ecbb23eeac7c9f3fbd460f60231bd
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
9d23e04c43dbb8480bea8be28b8a2f37423bec49 16-Feb-2013 Elliott Hughes <enh@google.com> Fix pthreads functions that should return ESRCH.

imgtec pointed out that pthread_kill(3) was broken, but most of the
other functions that ought to return ESRCH for invalid/exited threads
were equally broken.

Change-Id: I96347f6195549aee0c72dc39063e6c5d06d2e01f
f8a2c51bf3b85bf86bff905dd1232299d333dafe 13-Sep-2012 David 'Digit' Turner <digit@android.com> LONG_LONG_MIN/MAX: Move declarations to <limits.h>

LONG_LONG_MIN, LONG_LONG_MAX and ULONG_LONG_MAX are
GLibc-specific macros that are better defined in <limits.h>
instead of the current exotic location (<pthread.h>).

Note that GCC's <limits.h> only defines these macros
when __GNU_LIBRARY__ is also defined. This is only the
case when building against GLibc, so manually redefine
the macros here.

Note that using LLONG_MIN/LLONG_MAX/ULLONG_MAX is the
C99-compliant way to get these values, but it's easier
to define these compatibility macros for the sake of
porting existing code.

Change-Id: I8023918d73b4685238054932f94a4006c1ca7d03
9831ad3ce6bd5b22da16a275ed67e7236eae3d1f 29-Aug-2011 David 'Digit' Turner <digit@google.com> libc: speed-up flockfile()/funlockfile()

For Honeycomb, we added proper file thread-safety for
all FILE* operations. However, we did implement that by
using an out-of-band hash table to map FILE* pointers
to phtread_mutex_t mutexes, because we couldn't change
the size of 'struct _sFILE' without breaking the ABI.

It turns out that our BSD-derived code already has
some support code to extend FILE* objects, so use it
instead. See libc/stdio/fileext.h

This patch gets rid of the hash table, and put the
mutex directly into the sFILE extension.

Change-Id: If1c3fe0a0a89da49c568e9a7560b7827737ff4d0
847b183f631ccbaa363a15c24195c00cad9529f9 11-Mar-2011 David 'Digit' Turner <digit@android.com> libc: <pthread.h>: Replace '#if __cplusplus' by '#ifdef __cplusplus'

See http://code.google.com/p/android/issues/detail?id=15221

Change-Id: Ia7b6668c28737810d6c4941604c6adf232a27c61
ca4462d76c65ebfbc20328ee283ac2f19efca732 10-Mar-2011 David 'Digit' Turner <digit@android.com> libc: Fix PTHREAD_RWLOCK_INITIALIZER

The macro definition was incorrect and resulted in a compile error
when used.

Fixes http://code.google.com/p/android/issues/detail?id=15306

Change-Id: I8fa6047b63e7f56b53653774327099822c469cd1
bd8d987b3c3aa6d9d00cede2cb091f00bdb42204 26-Sep-2010 David 'Digit' Turner <digit@google.com> libc: remove C++ comments from public headers.

Change-Id: I4af84f912062cd2ff34711c25122fb323f20c032
4f086aeb4aa06e13079b7fec71a8178ceeacf318 25-Jun-2010 Matt Fischer <matt.fischer@garmin.com> Implemented pthread_atfork()

Change-Id: Ie6c0bf593315d3507b3c4a6c8903a74a1fa053db
78c1c04ced772298be8bdb5a94b6ce491bb9b3e1 20-May-2010 André Goddard Rosa <andre.goddard@gmail.com> pthread: introduce pthread_setname_np() as a mean to give names to threads

... so that each cloned process at the kernel level can be named
independently. Tools like 'top' can display the CPU/memory statistics
for each process's thread if "Show Threads" mode is on.

With this function in place, we can convert dalvik/Thread.c setThreadName()
function over this function. This feature ought to be provided by the
underlying C library and not coded directly in Dalvik.

Change-Id: Ifa997665dbaa114e0b126f8c667708be9a4137fd
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
8a1d2cf1422e35257c160ac5bb12dd3ee481c433 12-May-2010 David 'Digit' Turner <digit@google.com> Add pthread_rwlock_t implementation to the C library (DO NOT MERGE)

Change-Id: I756d8c26afc37cd7b71117ddbaa02a2cb40fdecb
a418c3b8370cae1c80fbe9a06e7e53025da5d6f0 12-May-2010 David 'Digit' Turner <digit@google.com> Add pthread_rwlock_t implementation to the C library

Change-Id: I14d0a112554756a7294a51fe88c1c408a16b5ff1
ee7b077abf1d99503b986489ad93374a057cb354 18-Mar-2010 David 'Digit' Turner <digit@google.com> Add pthread_condattr_init/destroy/setpshared/getpshared

Note that this does not change the implementation of conditional variables
which still use shared futexes, independent on the flags being selected.

This will be fixed in a later patch, once our system is modified to use
pthread_condattr_setpshared(attr, PTHREAD_PROCESS_SHARED) properly.

Change-Id: I935de50964cd41f97a13dbfd6626d3407b0406c3
8641833b62e3b319796dc80ea16eb1592c05edf6 11-Mar-2010 Fabrice Di Meglio <fdimeglio@google.com> Revert "bionic: pthread: use private futexes by default for mutexes and condvars"

This reverts commit ba9c6f0989ae94778ba2b9f597adc827c9dc81e8.
ba9c6f0989ae94778ba2b9f597adc827c9dc81e8 11-Mar-2010 David 'Digit' Turner <digit@google.com> bionic: pthread: use private futexes by default for mutexes and condvars

Private futexes are a recent kernel addition: faster futexes that cannot be
shared between processes. This patch uses them by default, unless the PROCESS_SHARED
attribute flag is used when creating a mutex and/or conditional variable.

Also introduces pthread_condattr_init/destroy/setpshared/getpshared.

Change-Id: I3a0e2116f467072b046524cb5babc00e41057a53
194d3fa048cf909ca592dd56fa538dc9cd3f5ddb 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
3f56b7f65adb9ee35cd0f878ca00b92011eec427 22-Sep-2009 David 'Digit' Turner <digit@google.com> Add pthread_mutex_lock_timeout_np

This is used to perform a mutex lock for a given amount of
milliseconds before giving up. Using the _np prefix since this
is absolutely not portable.

Also remove a compiler warning in pthread_attr_getstackaddr
a2f5e212448f36f0b35cf695d13bb4defdb4472e 14-Jul-2009 Mathias Agopian <mathias@google.com> added pthread_cond_timedwait_relative_np()
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
9f65adf2ba3bb15feb8b7a7b3eef788df3fd270e 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
4e468ed2eb86a2406e14f1eca82072ee501d05fd 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution