Re: wow, this actually works!
Re: wow, this actually works!
- Subject: Re: wow, this actually works!
- From: Scott Ruda <email@hidden>
- Date: Wed, 29 May 2002 00:35:56 -0700
Joshua Strickon <email@hidden> wrote:
The trick that got everything to work was to put any native routine
that opens
or closes a midi port into a new thread.
Bill Stewart <email@hidden> wrote:
Your thread doesn't have to do anything - you should be able to just
put it
into a wait state. CoreMIDI will wake it up through its run loop - then
when
its done its work it should just go back into wait...
while (true)
{
synchronized (this)
{
wait();
}
}
Let me see if I've grokked this. The workaround is to do any CoreMIDI
call in a new Thread instead of doing it in the Java dispatch thread,
right? Could this then be the basic model:
public void doCoreMIDIThing() {
Thread t = new Thread(new Runnable() {
public void run() {
// do actual CoreMIDI call here...
}
});
t.start();
// I want the call to be synchronous, so wait until the CoreMIDI
call is complete
try { t.join(); } catch (InterruptedException ie) {}
}
I didn't quite understand what Bill meant when he said 'the thread
doesn't have to do anything'. Doesn't the new thread have to do the
CoreMIDI call within it's run implementation?
Scott
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.