History log of /bionic/libc/bionic/semaphore.c
Revision Date Author Comments
668da74ef1d4558f699374cb28a9df1a011db122 07-Jul-2014 Elliott Hughes <enh@google.com> Use __unused rather than self assignment for unused parameters.

Clang, reasonably enough, doesn't like self assignment.

Change-Id: Ie5843287802949dad148a1a815231035678e1306
95d3cd0b85724d3702cfb71942f9aa0a5ee27c74 02-Jul-2014 Elliott Hughes <enh@google.com> Quiten warnings in semaphore.c.

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

Bug: 14903517
Change-Id: I7b5bcebe58774a441da986cc02376dd88e00ea0e
eb847bc8666842a3cfc9c06e8458ad1abebebaf0 10-Oct-2013 Elliott Hughes <enh@google.com> Fix x86_64 build, clean up intermediate libraries.

The x86_64 build was failing because clone.S had a call to __thread_entry which
was being added to a different intermediate .a on the way to making libc.so,
and the linker couldn't guarantee statically that such a relocation would be

ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC

This patch addresses that by ensuring that the caller and callee end up in the
same intermediate .a. While I'm here, I've tried to clean up some of the mess
that led to this situation too. In particular, this removes libc/private/ from
the default include path (except for the DNS code), and splits out the DNS
code into its own library (since it's a weird special case of upstream NetBSD
code that's diverged so heavily it's unlikely ever to get back in sync).

There's more cleanup of the DNS situation possible, but this is definitely a
step in the right direction, and it's more than enough to get x86_64 building

Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
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