[Portaudio] linux port and threading

Stephen Brandon stephen@pyrusmalus.com
Mon, 28 May 2001 16:35:47 +0100


Hi all,

I'm using/testing the linux port in the Objective-C SndKit framework. The SndKit uses threading; the
type of threading used is an abstraction from the GNUstep base framework, which can be in turn
determined by which type of threading support is built into libobjc (part of the gcc project).

Anyway, to cut a long story short, I'm using pthreads in GNUStep. Before I had pthread support
enabled, the portaudio __clone worked perfectly. After starting to use pthreads, __clone stopped
working. I don't know how/why -- it didn't return any errors, just silently didn't call the forked
function.

So, I made a couple of changes to pa_linux.c to change from __clone to pthreads, and it now works
again perfectly in SndKit.

So the question is, is there any particular reason why portaudio (linux) should not use pthreads
instead of __clone? According to the man page for clone, clone is not portable, whereas pthreads are
available on a number of other platforms. And the change to the pa_linux code is pretty minor.

It would be great (from my point of view) if portaudio_linux could move to the pthread
implementation -- then I wouldn't have to patch it any time I update from the official tree.

(NB I'm not a threading expert, so please comment on anything relevant to this)

I'll send diffs to anyone who wants them.

Cheers,
Stephen Brandon
stephen@pyrusmalus.com