On Thursday 15 December 2005 10:53, Victor Lazzarini wrote: > I suppose it could be a question of setting priorities for the threads, can > that be done in Python. The problem he reports does not seem to happen in > Java. Would it be the case for adding up a Python module (written in C) > that starts a thread for a given Csound instance (more or less as the csPlay > command in Tclcsound?), running csoundKsmps() in a loop? > That would have to be added by hand, I suppose, unless an API function is > added to do it (which perhaps is not really something to have in the API). Using threads in Python is somewhat limited, as there is a global interpreter lock that basically prevents other Python statements from being called while for example a Csound API function is used through the wrapper interface. This means that if you start Csound::Perform(), the other threads will probably freeze until the entire score is performed (at least that is what I found while experimenting with the interface). While it is of course possible to add a new function to the csnd library that starts a Csound performance in a separate thread and then returns immediately, it should be noted that thread safe wrappers for functions that may be useful in the other thread (e.g. those related to creating score events) need to be added as well. Actually, the way the Csound API is used in TclCsound is unsafe (you may get random crashes sometimes), using the same CSOUND* instance from multiple threads at the same time needs synchronization. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net