Csound Csound-dev Csound-tekno Search About

[Cs-dev] serious issue: portmidi is not reentrant

Date2010-02-26 21:59
FromVictor Lazzarini
Subject[Cs-dev] serious issue: portmidi is not reentrant
Hi everyone,

I'm wondering why we have not yet bumped into this one, but there you  
go. It seems portmidi might not be usable at all for us, because it is  
not reentrant. This means that we are limited to one instance of  
Csound per process. The second instance will crash the program at some  
point; in my tests it is at destruction.  This simple program  
demonstrates
the problem (on OSX at least). If we open the pmidi module (which  
loads portmidi and initializes it), the program will crash after play  
time 2. If we don't use -M, it runs to the next play time.

This is very serious as it undermines all API-based frontends. Maybe  
it's time we look for a substitute, if there is one. As I can see, OSX  
is the only platform with no alternatives to pmidi. Perhaps the  
solution is to write one? Not looking forward to it, though; but I  
have taught CoreMIDI last semester, so I should know how to use it. I  
would prefer a multiplatform solution.

#include 
#include 
#include 
#include 

int main(int argc, char **argv){

   Csound *cs;

   for (int i=0; i < 3; i++) {
     fprintf(stdout, "=========== PLAY TIME %d ===========\n", i+1);
   cs = new Csound();
   cs->Compile(argc, argv);
   cs->Perform();
   delete cs;
   }
   return 0;
}

Victor

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-26 22:05
FromMichael Gogins
SubjectRe: [Cs-dev] serious issue: portmidi is not reentrant
The STK MidiIn and MidiOut classes might provide an alternative, or
the beginnings of one. I haven't looked to see if it's re-entrant, but
if not, it probably can be made so.

Regards,
Mike

On Fri, Feb 26, 2010 at 4:59 PM, Victor Lazzarini
 wrote:
> Hi everyone,
>
> I'm wondering why we have not yet bumped into this one, but there you
> go. It seems portmidi might not be usable at all for us, because it is
> not reentrant. This means that we are limited to one instance of
> Csound per process. The second instance will crash the program at some
> point; in my tests it is at destruction.  This simple program
> demonstrates
> the problem (on OSX at least). If we open the pmidi module (which
> loads portmidi and initializes it), the program will crash after play
> time 2. If we don't use -M, it runs to the next play time.
>
> This is very serious as it undermines all API-based frontends. Maybe
> it's time we look for a substitute, if there is one. As I can see, OSX
> is the only platform with no alternatives to pmidi. Perhaps the
> solution is to write one? Not looking forward to it, though; but I
> have taught CoreMIDI last semester, so I should know how to use it. I
> would prefer a multiplatform solution.
>
> #include 
> #include 
> #include 
> #include 
>
> int main(int argc, char **argv){
>
>   Csound *cs;
>
>   for (int i=0; i < 3; i++) {
>     fprintf(stdout, "=========== PLAY TIME %d ===========\n", i+1);
>   cs = new Csound();
>   cs->Compile(argc, argv);
>   cs->Perform();
>   delete cs;
>   }
>   return 0;
> }
>
> Victor
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-26 22:10
FromVictor Lazzarini
SubjectRe: [Cs-dev] serious issue: portmidi is not reentrant
Do you mean RTmidi?
http://www.music.mcgill.ca/~gary/rtmidi/

Victor
On 26 Feb 2010, at 22:05, Michael Gogins wrote:

> The STK MidiIn and MidiOut classes might provide an alternative, or
> the beginnings of one. I haven't looked to see if it's re-entrant, but
> if not, it probably can be made so.
>
> Regards,
> Mike
>
> On Fri, Feb 26, 2010 at 4:59 PM, Victor Lazzarini
>  wrote:
>> Hi everyone,
>>
>> I'm wondering why we have not yet bumped into this one, but there you
>> go. It seems portmidi might not be usable at all for us, because it  
>> is
>> not reentrant. This means that we are limited to one instance of
>> Csound per process. The second instance will crash the program at  
>> some
>> point; in my tests it is at destruction.  This simple program
>> demonstrates
>> the problem (on OSX at least). If we open the pmidi module (which
>> loads portmidi and initializes it), the program will crash after play
>> time 2. If we don't use -M, it runs to the next play time.
>>
>> This is very serious as it undermines all API-based frontends. Maybe
>> it's time we look for a substitute, if there is one. As I can see,  
>> OSX
>> is the only platform with no alternatives to pmidi. Perhaps the
>> solution is to write one? Not looking forward to it, though; but I
>> have taught CoreMIDI last semester, so I should know how to use it. I
>> would prefer a multiplatform solution.
>>
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> int main(int argc, char **argv){
>>
>>   Csound *cs;
>>
>>   for (int i=0; i < 3; i++) {
>>     fprintf(stdout, "=========== PLAY TIME %d ===========\n", i+1);
>>   cs = new Csound();
>>   cs->Compile(argc, argv);
>>   cs->Perform();
>>   delete cs;
>>   }
>>   return 0;
>> }
>>
>> Victor
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-26 22:20
FromMichael Gogins
SubjectRe: [Cs-dev] serious issue: portmidi is not reentrant
AttachmentsNone  None  

Yes.

MKG from cell phone

On Feb 26, 2010 5:10 PM, "Victor Lazzarini" <Victor.Lazzarini@nuim.ie> wrote:

Do you mean RTmidi?
http://www.music.mcgill.ca/~gary/rtmidi/

Victor

On 26 Feb 2010, at 22:05, Michael Gogins wrote:

> The STK MidiIn and MidiOut classes might provide ...