History log of /bionic/libc/bionic/semaphore.c
Revision Date Author Comments
e31bfae2baa96742f998155ee26e56c826a8ce3a 15-Nov-2011 David 'Digit' Turner <digit@android.com> bionic: Do not use <sys/atomics.h> for platform code.

We're going to modify the __atomic_xxx implementation to provide
full memory barriers, to avoid problems for NDK machine code that
link to these functions.

First step is to remove their usage from our platform code.
We now use inlined versions of the same functions for a slight
performance boost.

+ remove obsolete atomics_x86.c (was never compiled)

NOTE: This improvement was benchmarked on various devices.
Comparing a pthread mutex lock + atomic increment + unlock
we get:

- ARMv7 emulator, running on a 2.4 GHz Xeon:
before: 396 ns after: 288 ns

- x86 emulator in KVM mode on same machine:
before: 27 ns after: 27 ns

- Google Nexus S, in ARMv7 mode (single-core):
before: 82 ns after: 76 ns

- Motorola Xoom, in ARMv7 mode (multi-core):
before: 121 ns after: 120 ns

The code has also been rebuilt in ARMv5TE mode for correctness.

Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
519763265ec0b634bd9c264a0aca034882458ecc 28-Jun-2010 David 'Digit' Turner <digit@google.com> libc: Fix sem_post() implementation to wake up all waiting threads.

This also allows us to optimize the case where we increment an
uncontended semaphore (no need to call futex_wake() then).

Change-Id: Iad48efe8551dc66dc89d3e3f18c001e5a6c1939f
6c8a2f2a5bc8d612ee953f528f2b5eb35983656a 11-Jun-2010 David 'Digit' Turner <digit@google.com> 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
6304d8b21891fd0cb7b5a4c25159a3d3b1709d62 03-Jun-2010 David 'Digit' Turner <digit@google.com> 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.
7c99c1856fce65c0394cd578c2a8ed37da2f288d 28-May-2010 Andy McFadden <fadden@android.com> Atomic/SMP update, part 3. (manual merge)

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: I595cc8e5a8d1e4906b6641115e46208a7e9e755a
fcd00ebbdf3e7f4e1e7782a65ae10fb0fc03a1aa 28-May-2010 Andy McFadden <fadden@android.com> 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
4f920f685bb4af8400c70383eecf347a35353778 12-Feb-2010 David 'Digit' Turner <digit@google.com> Fix sem_post() behaviour to wake up multiple waiting threads.
294dd0b86b1484aec7549663aff5b19c98a4b7fd 12-Feb-2010 David 'Digit' Turner <digit@google.com> Fix sem_trywait() implementation + update changelog.
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
d37527501c85edcb3a6a7c8a0b6297d52d434897 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution