how to set mutex can be shared between different process.

by waterblood » Tue, 03 Mar 2009 08:27:18 GMT

Sponsored Links
 Hi All,

   Usually we use  pthread_mutexattr_setpshared to share different
mutex with different process. But I have checked the bionic libc
implementation. It only support PTHREAD_PROCESS_PRIVATE setting.
Does it mean android does not support mutex shared between different

pthread.c in android/bionic/libc/bionic

772 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int
 773 {
 774     if (!attr)
 775         return EINVAL;
 777     return (pshared == PTHREAD_PROCESS_PRIVATE) ? 0 : ENOTSUP;
 778 }

Guoyin Chen

how to set mutex can be shared between different process.

by Freepine » Wed, 04 Mar 2009 13:58:29 GMT

 Perhaps you can try to use a semaphore file instead?


Sponsored Links

how to set mutex can be shared between different process.

by Dave Sparks » Thu, 05 Mar 2009 07:44:17 GMT

 What is the use case for a shared mutex?

We use shared mutex for IPC shared process memory. See AudioTrack/
AudioFlinger for sample code. In the case, the sharing works because
the mutex is in the shared memory and both process have access to it.


Other Threads

1. Upgraded SDK, now can't do helloAndroid project

Make sure you've followed all the steps at


Xavier Ducrohet
Android Developer Tools Engineer
Google Inc.


2. Okay, so we don't put ListView in ScrollView. Now what? (2nd attempt)

My first attempt to post this seems to have failed. This is a second

I am trying to display a screen filled with data fetched from a
server. The data, if it were HTML, would look something like the
following (try to visualize =) ):

<h1>This Is the Title</h1>
<p>Here is some pertinent info.</p>
<p>Below here is a list with ~1-10 items, depending</p>
<td>This first item is neat!</td>
<td>Looks like we only got two items this time. Who knew?</td>

So I naively tried to put a ListView in a ScrollView. Not only did it
not work, but I've since read all about why it is bad by the likes of
such luminaries as Hackborn and Guy (it nullifies the optimizations,

Problem is, the half dozen places that said NOT to do it didn't
recommend what I SHOULD do instead, excepting one post by Romain Guy
specifying footer or header use (not suitable in my example, right?).
In other words, it seems like people want to mix a list of items in
among other text data, getting the benefits of a ListAdapter, but this
isn't addressed anywhere that I can find.

So, what is The Right Way to implement my example above? I'm a step
away from trying to add TextViews inside a for loop, which just
doesn't sit right in my gut.

Thank you for your time.


3. Android source code versions

4. Camera application 1.5 on emulator does nothing

5. Fwd: Recording Audio

6. UI not responsive

7. Extending Drawable Class