<br>Hi Chuck,<br>Check out the early bits of this thread --- various use cases already came up along the way: <a href="http://lists.puredata.info/pipermail/pd-dev/2012-01/017992.html">http://lists.puredata.info/pipermail/pd-dev/2012-01/017992.html</a>.  The short version is that libpd is being used in such a wide range of settings that you can come up with legitimate use cases for pretty much anything (single Pd instance shared between several threads, multiple Pd instances in one thread, and anything in between).  At the level of the audio library, it&#39;s impossible to make good assumptions about threading.<br>
<br><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I remember a conversation with IOhannes in August about<br>
multi-threading audio via sub-canvas user interface object (propose<br>
thread~ akin to block~).  If all you&#39;re after is audio<br>
multi-threading--there&#39;s no need for multiple instances of Pd.<br>
Threads could be used to start a portion of the dsp chain, running<br>
asynchronously, and then join/synchronize with Pd when finished.<br></blockquote><div><br>I don&#39;t think a patch is the place where decisions about threading should be made.  Threading is an implementation detail that users shouldn&#39;t have to worry about, and besides, whether you have anything to gain from threading will depend on a number of factors that users won&#39;t necessarily be able to control or even know about.<br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
What this would look like:  Add a thread_prolog, thread_epilog, and<br>
thread_sync function. The thread_prolog function that occurs before<br>
block_prolog, starts a thread running the portion of dsp chain<br>
cointained within, and returns the pointer to the function following<br>
the thread_epilog.  The thread_epilog function that occurs after<br>
block_epilog--waits for synchronization and returns. <br></blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
What&#39;s the difficult part: You would need to have a good ordering of<br>
the dsp chain to take advantage of concurrency--each subcanvas having<br>
a thread~ object needs to kick off as early as possible, followed by<br>
objects that have no dependence on its output.  Secondly, you&#39;d need<br>
to put thread_sync on the dsp chain immediately before you will<br>
encounter functions with data dependencies.<br></blockquote><div><br>I believe it&#39;s much simpler than that.  It should be enough to just do a topological sort of the signal processing graph; that&#39;ll tell you which objects are ready to run at any given time, and then you can parallelize the invocation of their perform functions (or not, depending on how many processors are available).  I don&#39;t think there&#39;s any need to explicitly synchronize much; tools like OpenMP should be able to handle this implicitly.<br>
Cheers,<br>     Peter<br><br><br></div></div>