This is correct, and this is one reason why I kind of hope Lua takes off, as it does not have the global lock.
I think locks can easily be introduced in the Csound.hpp stuff, however, using a mutex class with mutex objects declared on the stack at the beginning of each call.
From: Istvan Varga <istvan_v@...>
Sent: Dec 15, 2005 8:40 AM
Subject: Re: [Cs-dev] (no subject)
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
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
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!
Csound-devel mailing list