[pulseaudio-discuss] semaphores macosx, comments please

Claesson Mattias Mattias.Claesson at se.fujitsu.com
Thu Nov 12 10:37:26 PST 2009


Hi,

This is what I did for src/pulsecore/semaphore-osx.c
@@ -21,11 +21,11 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#include <Multiprocessing.h>
+#include <CoreServices/CoreServices.h>
 
 #include <pulse/xmalloc.h>
 #include <pulsecore/macro.h>
 
 #include "semaphore.h"

----------------

POSIX unnamed semaphores are not supported under macos x. Other free software use named semaphores (that is supposed to work) to implement also unnamed semaphores.
sem_open("clever random name")  + sem_unlink() instead of sem_init() + sem_close().
Tried a quick test and it should be possible to get this to work, it all depends on the "random name" used.
---------------

Yet another option would be to do a API change and use named semaphores from the rest of PA. 
Is this suggestion possible? 

---------------
In this file:
src/pulsecore/semaphore-osx.c
this function appears to be unused: 
pa_semaphore* pa_static_semaphore_get(pa_static_semaphore *s, unsigned value) {
It is also not implemented in any of osx or win32 implementation.
Correct?

Best Regards,
Mattias Claesson

________________________________________
Från: Claesson Mattias
Skickat: den 5 november 2009 19:23
Till: General PulseAudio Discussion
Ämne: SV: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends

Hi,

>Which version did you compile? You should use git to check out the latest sources for that. Some changes mandatory for Mac OS X builds came in after the last release.
I just cloned the latest one (I think, new to that tool) using:
git clone git://git.0pointer.de/pulseaudio.git

Its a bit strange that the posix calls does not work for semphores on macox, but a temporary workaround is better than nothing.

All but the first point (1) are dirty hacks to force semaphore-osx.c to compile and link.
I will try to make a git diff of the include change (1).

The osx specific semaphore file must be pointed to properly in the Makefile.am. Something similar to IS_OS_WIN32, if we cannot adapt the posix to work also for macos. I can make that change for sure.

Best Regards,
Mattias Claesson

> Things I needed to adapt was:
> 1. semaphore-osx.c
> #include <Multiprocessing.h>    >>>  #include <CoreServices/CoreServices.h> (old include was renamed in newer macos headers, according to google)
>
> 2. These was no way for the osx version to be compiled in the build so I just changed the src/Makefile.am
> pulsecore/semaphore-posix.c pulsecore/semaphore.h
> >>>
> pulsecore/semaphore-osx.c pulsecore/semaphore.h
>
> 3. Dynamic linkage error because symbolic link missing for the MPCreateSemaphore API call. Added the library to Makefile.am.
> libpulsecommon_ at PA_MAJORMINORMICRO@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
> >>>
> libpulsecommon_ at PA_MAJORMINORMICRO@_la_LDFLAGS = -framework Carbon $(AM_LDFLAGS) -avoid-version



More information about the pulseaudio-discuss mailing list