"static" is ok if you want one separate thread to handle all instances of
your extern... if, as in readsf~ and writesf~, you need a separate thread
for each instance, better put the mutexes and whatnot in the instance structure.
On Thu, Jul 25, 2002 at 05:55:11PM +0200, Olaf Matthes wrote:
Miller Puckette wrote:
It would have to open a separate thread to respond to the jack calls,
and maintain FIFOs to synchronize between them.
which brings me to another question, what do people on the list think
about multithreaded externals and shouldn't we agree now on how to
AFAICT from my somewhat limited pthread knowledge each and every extern
author using threads should at least prefix mutex/conditional names
with externalname_ otherwise we might well deadlock ourselves sooner
than later .. any other thoughts/recommendations on this ?
Well, there already are two threaded objects in the standard Pd distribution:
readsf~ and writesf~. I've successfully used the same 'principles' in my
oggamp~ and oggcast~ externals and can run all of them togehter (or several
instances of the same object) in one patch without any difficulties.
Maybe I just missed the point but I personally don't see any problems why
threaded externals should interfere (as long as the mutex/conditional
variables are declared as 'static'). But I also have to admit that I'm no
thread-expert.... (not even a C expert, just trying until it works)