Re: C++ thread messaging cocoa thread
Re: C++ thread messaging cocoa thread
- Subject: Re: C++ thread messaging cocoa thread
- From: Simon Strandgaard <email@hidden>
- Date: Thu, 14 Jul 2005 22:43:01 +0200
On 7/14/05, Nick Zitzmann <email@hidden> wrote:
>
> On Jul 14, 2005, at 1:36 PM, Simon Strandgaard wrote:
>
> > 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
>
> As a general rule, you shouldn't use AppKit classes in any thread
> other than the main thread. There are a few classes and methods that
> are thread-safe (e.g. NSProgressIndicator) but most of them aren't.
Yes I am aware of that.. I just needed to explain my situation :-)
[snip]
> > // Help, How to message my cocoa mainthread?
>
> <file:///Developer/ADC Reference Library/documentation/Cocoa/
> Reference/Foundation/ObjC_classic/Classes/NSObject.html#//apple_ref/
> doc/uid/20000050-CJBEHAEF>
>
> Nick Zitzmann
Thanks Nick for the quick reply, that did do the trick.
I inserted this code and it simply worked..
[midi_dispatcher
performSelectorOnMainThread:@selector(incomingMessage)
withObject:nil
waitUntilDone:NO
];
I am aware than NSInvocation can be used for tranfering arguments.
--
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