C++ thread messaging cocoa thread
C++ thread messaging cocoa thread
- Subject: C++ thread messaging cocoa thread
- From: Simon Strandgaard <email@hidden>
- Date: Thu, 14 Jul 2005 21:36:25 +0200
I have made a cocoa GUI, which I want to be controllable
from my MIDI keyboard.
The midi_read_callback is in a thread that doesn't have a
NSAutoreleasepool, so if I invoke any methods on the
GUI instance then I get warnings like this.
_NSAutoreleaseNoPool(): Object 0xa2e89ccc of class NSCFString
autoreleased with no pool in place - just leaking
Correct me if I am wrong; I think that the only option I have
is to add a NSPort to the cocoa runloop, which is signaled
from C++..
how to refer from C++ to a NSPort?
should I use CFMessagePortCreateRemote ?
Any advices will be appreciated.
MIDIPortRef inport = 0;
void midi_read_callback(
const MIDIPacketList *pktlist,
void *refCon,
void *connRefCon) {
// Help, How to message my cocoa mainthread?
}
void midi_setup() {
MIDIClientRef client = 0;
MIDIClientCreate(CFSTR("Test"), 0, 0, &client);
MIDIInputPortCreate(
client,
CFSTR("Input port"),
midi_read_callback,
0,
&inport
);
MIDIPortConnectSource(inport, MIDIGetSource(0), 0);
}
--
Simon Strandgaard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden