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
processes?

pthread.c in android/bionic/libc/bionic

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


Thanks
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. Big problem with extra data in intent

Hi,

I want to send RINGER_MODE update to an activity using an alarm
manager and a BroadcastReceiver.

So, in the file which is listening to
"android.media.EXTRA_RINGER_MODE", I have this :

if(intent.getAction().equals("android.media.RINGER_MODE_CHANGED")) {
                                myAudio.setRingerMode(intent.getIntExtra
("android.media.EXTRA_RINGER_MODE", -1));
                                System.out.println("Changement de son: "  + 
Intent.getIntExtra
("android.media.EXTRA_RINGER_MODE", -1));
                                System.out.println("bla : " + getRingerMode());
                                sendRingerModeChangedBroadcast(getRingerMode());
                        }

...

Intent i = new Intent("com.tests.AudioInfo.RINGER_MODE_CHANGED");
                        i.putExtra("myMode", newMode);
                        PendingIntent broadcastSender = 
PendingIntent.getBroadcast(context,
0, i, 0);
                        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime(), broadcastSender);
                        System.out.println("here: " + i.getIntExtra("myMode", 
55));
...


And then in another file which receives it, I have :

public void onReceive(Context context, Intent intent) {
...
   else if(intent.getAction().equals
("com.tests.AudioInfo.RINGER_MODE_CHANGED")) {
                                int newMode = intent.getIntExtra("myMode", 55);
                                System.out.println("there: " + newMode);
                                System.out.println("Ringer mode changed: " + 
intent.getIntExtra
("myMode", 55));
   }


So in "here:" and "there:" I should have the same value.
It works when this function is called for the first time but after,
"here:" is always followed by the new values whereas "there:" is
followed by the first value.
So the line int newMode = intent.getIntExtra("myMode", 55);  does not
work anymore.

Could you explain to me why?

--~--~---------~--~----~------------~-------~--~----~

2. Interrupted audio playback.

Hello,

the game I am working on uses SoundPool for sound effects and
MediaPlayer for background music playback.
Input happens enirely through the touch screen, with a 20 mS delay
after each processed MotionEvent.
Sometimes (very rarely) it happens that the background music gets
interrupted for a fraction of a second during input.
Do you have any ideas how to ensure MediaPlayer continues audio
playback during touch screen input?

All audio files are in ogg format with various sample and bit rates.
Would it be an advantage if all audio files would share the same
samplerate and/or bitrate?

Do you have any other ideas how to improve audo playback performance?

Any advice is welcome!
Thanks in advance,
Mike.

--~--~---------~--~----~------------~-------~--~----~

3. How to use CursorJoiner to join two table?

4. How to extract ICON from an APK file?

5. How to record the audio from mic in raw pcm format into a buffer, using the native libraries directly?

6. R.drawable.my_icon Missing

7. How to configure the sampling rate/period while audio capture?