Commit graph

40 commits

Author SHA1 Message Date
Bruce Beare
8e551a6319 bionic, libthread_db x86 fixes
Change-Id: I3be997f5f1f6a894a3c200d4f325cf3bfd428c66
Author: James Rose <james.rose@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-04-27 09:12:58 -07:00
David 'Digit' Turner
5c8c00a95a libc: Fix the definition of SIGRTMAX
After this change, SIGRTMAX will be set to 64 (instead of 32 currently).
Note that this doesn't change the fact that our sigset_t is still defined
as a 32-bit unsigned integer, so most functions that deal with this type
won't support real-time signals though.

Change-Id: Ie1e2f97d646f1664f05a0ac9cac4a43278c3cfa8
2010-12-20 15:58:06 +01:00
Andy McFadden
b1c9cc2f2d Add memory barriers to pthread_once.
The implementation was using a double-checked locking approach that
could break on SMP.

In addition to the barriers I also switched to a volatile pointer.  I
don't think this will matter unless gcc can conclude that _normal_lock
can't affect *once_control, but I figured it was better to be safe.
(It seems to have no impact whatsoever on the generated code.)

Bug 3022795.

Change-Id: Ib91da25d57ff5bee4288526e39d457153ef6aacd
2010-09-23 12:30:12 -07:00
Andy McFadden
e2ac89869f Add a memory barrier to cond var signaling.
This adds an explicit memory barrier to condition variable signaling.
It's a little murky as to whether it's strictly required, but it seems
like a wise thing to do.

Change-Id: Id0faa542d61e4b8ffa775e4adf68e4d7471f4fb7
2010-09-02 13:34:53 -07:00
David 'Digit' Turner
4e6043a355 am 7d1d98b9: am a02b93bd: libc: add sanity checks to pthread_mutex_destroy()
Merge commit '7d1d98b97e947de22aff4c0b67eec7ae68c822ee'

* commit '7d1d98b97e947de22aff4c0b67eec7ae68c822ee':
  libc: add sanity checks to pthread_mutex_destroy()
2010-06-29 12:55:34 -07:00
David 'Digit' Turner
a02b93bd75 libc: add sanity checks to pthread_mutex_destroy()
Change-Id: Iddb2204fa792fa9aca5f19838926dddbb09b74a2
2010-06-28 14:20:22 -07:00
Wink Saville
ccc3d1eea1 Use a recursive lock for pthread_once.
bug: 2292366
Change-Id: I9fc8b790dcfcb30ca94a0beb340d43fe5cd6c22e
2010-06-28 11:41:16 -07:00
David 'Digit' Turner
50ace4fec5 Remove compiler warnings when building Bionic.
Also add missing declarations to misc. functions.
Fix clearerr() implementation (previous was broken).
Handle feature test macros like _POSIX_C_SOURCE properly.

Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
2010-06-22 17:51:41 -07:00
David 'Digit' Turner
6c8a2f2a5b libc: remove cutils dependencies
We simply copy the stuff we need from cutils headers.

A future patch will change cutils to include the private <bionic_atomic_inline.h>

Change-Id: Ib6fd9a03bc9e337ce867bd606dc94c2b4438480a
2010-06-11 13:49:09 -07:00
David 'Digit' Turner
6304d8b218 Use private futexes for semaphores, unless they are initialized with pshared != 0.
Change-Id: I534e36a7171cd37037ae03b910ba71ea6968286d
Note: previously, sem_init() would return an error if pshared != 0.
2010-06-08 17:04:49 -07:00
Jean-Baptiste Queru
a8a2148863 resolved conflicts for merge of 7b6e6fa5 to kraken
Change-Id: I2b9b80a7fa32c56be2b85ff8be0d6e7ac1848afe
2010-06-03 15:05:04 -07:00
The Android Open Source Project
7b6e6fa572 merge from open-source master
Change-Id: Ib7fc9c6f79f9b13e2175da137005d8968ea85eaf
2010-06-03 14:39:20 -07:00
Andy McFadden
fcd00ebbdf Atomic/SMP update, part 3.
Update ARM atomic ops to use LDREX/STREX.  Stripped out #if 0 chunk.

Insert explicit memory barriers in pthread and semaphore code.

For bug 2721865.

Change-Id: I0f153b797753a655702d8be41679273d1d5d6ae7
2010-05-28 16:12:01 -07:00
André Goddard Rosa
78c1c04ced 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>
2010-05-19 23:17:16 -03:00
David 'Digit' Turner
5207d78c32 Fix typo that broke recursive mutexes implementation.
Change-Id: I832901604b487c6a50304c311b5ba135e153530d
2010-03-23 05:30:55 -07:00
David 'Digit' Turner
b5e4a41606 pthread: Use private futexes by default in condition variables
Now that the system properly uses shared condvars when needed, we
can enable the use of private futexes for them too.

Change-Id: Icf8351fc0a2309f764cba45c65bc3af047720cdf
2010-03-22 17:31:50 -07:00
The Android Open Source Project
377d4c979d merge from open-source master
Change-Id: I70266ee8c520b216773f267e46c8273d2334c31d
2010-03-22 15:55:09 -07:00
David 'Digit' Turner
88f06cd84a Use private futexes for pthread_mutex_t.
This does not change the implementation of conditional variables
since we're waiting for other system components to properly use
pthread_condattr_init/setpshared before that.

Also remove an obsolete x86 source file.

Change-Id: Ia3e3fbac35b87a534fb04d4381c3c66b975bc8f7
2010-03-18 17:13:41 -07:00
David 'Digit' Turner
ee7b077abf 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
2010-03-18 14:07:42 -07:00
David 'Digit' Turner
40e6b82286 Fix indentation in pthread mutex implementation.
This is preliminary work to simplify later changes to support
private futexes.

Change-Id: I06750936a93747a5e3f5a10228cbdc29e39c528c
2010-03-17 11:25:46 -07:00
Fabrice Di Meglio
8641833b62 Revert "bionic: pthread: use private futexes by default for mutexes and condvars"
This reverts commit ba9c6f0989.
2010-03-11 14:47:47 -08:00
David 'Digit' Turner
ba9c6f0989 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
2010-03-11 11:48:38 -08:00
David 'Digit' Turner
8f8b5310d2 Fix pthread_sigmask() to return correct error values.
Before that, it returned -1 on error and set errno (not Posix)
After the patch, it returns the error code and leaves errno untouched.
2010-03-01 11:30:40 -08:00
André Goddard Rosa
a28336c735 bionic: on pthread_join(), avoid extra check in case we find the thread
... by using similar logic as used in pthread_detach().

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-02-05 16:21:07 -02:00
Jean-Baptiste Queru
95604529ec merge from eclair 2009-11-15 12:05:31 -08:00
Jean-Baptiste Queru
194d3fa048 eclair snapshot 2009-11-12 18:45:14 -08:00
David 'Digit' Turner
7e5e9f4270 am bc10cd29: Fix a typo that resulted in a crash in the boot sequence
Merge commit 'bc10cd2900cdb7fed077163b6a33e0f8572b2b19' into eclair-plus-aosp

* commit 'bc10cd2900cdb7fed077163b6a33e0f8572b2b19':
  Fix a typo that resulted in a crash in the boot sequence
2009-09-23 16:09:39 -07:00
David 'Digit' Turner
bc10cd2900 Fix a typo that resulted in a crash in the boot sequence 2009-09-23 15:56:50 -07:00
David 'Digit' Turner
9641805419 am d154954f: Merge change 26419 into eclair
Merge commit 'd154954f02691618fdf73a5a97336e64cad37af0' into eclair-plus-aosp

* commit 'd154954f02691618fdf73a5a97336e64cad37af0':
  Add pthread_mutex_lock_timeout_np
2009-09-23 12:20:52 -07:00
David 'Digit' Turner
3f56b7f65a 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
2009-09-22 15:17:50 -07:00
Jean-Baptiste Queru
895244b2ab merge from open-source master 2009-09-16 16:21:35 -07:00
Matthieu CASTET
a4e67f4512 Remove code duplication for pthread_cond_timeout_np : use __pthread_cond_timedwait_relative helper 2009-09-14 09:19:42 -07:00
Mathias Agopian
b7681167cb allow pthread_mutexattr_setpshared to accept SHARED mutexes, since our current impl actually uses shared mutexes 2009-07-13 22:00:33 -07:00
Mathias Agopian
a2f5e21244 added pthread_cond_timedwait_relative_np() 2009-07-13 18:37:40 -07:00
The Android Open Source Project
1dc9e472e1 auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
The Android Open Source Project
1767f908af auto import from //depot/cupcake/@135843 2009-03-03 18:28:13 -08:00
The Android Open Source Project
9f65adf2ba auto import from //branches/cupcake/...@130745 2009-02-10 15:43:56 -08:00
The Android Open Source Project
e5cc1f386b auto import from //branches/cupcake/...@126645 2009-01-15 16:12:07 -08:00
The Android Open Source Project
4e468ed2eb Code drop from //branches/cupcake/...@124589 2008-12-17 18:03:48 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00