Ticket #40 (assigned enhancement)

Opened 21 months ago

Last modified 21 months ago

Support OS X 10.3

Reported by: bjornroche Owned by: bjornroche
Priority: minor Milestone:
Component: host-api-coreaudio Version:
Keywords: 10.3 tiger panther 10.4 Cc:

Description (last modified by bjornroche) (diff)

PortAudio currently does not support OS X 10.3. The dependence on 10.4 is due to Memory barriers which are more reliable in 10.4 than they are in 10.3. It might be possible to use weak linking to support 10.3, albeit without memory barriers, but the situation is not clear. Other options have been discussed on the mailing list.

Change History

Changed 21 months ago by bjornroche

  • status changed from new to assigned
  • description modified (diff)

Changed 21 months ago by bjornroche

A bit more:

There are known bugs in the hardware implementation of asm volatile("sync":::"memory"), which OSMemoryBarrier (only available in OS 10.4) works around.

Assuming OSMemoryBarrier() is weak linked, the correct solution (supporting the best memory barriers available at runtime), including optimization for OS X 10.4, is probably to use something like this:

#      define PaUtil_FullMemoryBarrier() do { __biultin_expect(OSMemoryBarrier != NULL, true) ? OSMemoryBarrier() : asm volatile("sync":::"memory") } while(false)
#      define PaUtil_ReadMemoryBarrier()  do { __biultin_expect(OSMemoryBarrier != NULL, true) ? OSMemoryBarrier() : asm volatile("sync":::"memory") } while(false)
#      define PaUtil_WriteMemoryBarrier() do { __biultin_expect(OSMemoryBarrier != NULL, true)  ? OSMemoryBarrier() : asm volatile("sync":::"memory") } while(false)

This could be compiled on OS X 10.4 and should run on 10.3, provided the makefile was changed in a few ways:

Define minimum deployment level of 10.2 so that weak linking is supported:

MACOSX_DEPLOYMENT_TARGET:=10.2 export MACOSX_DEPLOYMENT_TARGET

Other things may be required as described here:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

Note: See TracTickets for help on using tickets.