Re: help w/ async message queue
Re: help w/ async message queue
- Subject: Re: help w/ async message queue
- From: "William Zumwalt" <email@hidden>
- Date: Fri, 18 Jan 2008 22:36:47 -0600
It has a runloop, and the background thread is calling via YAMessageQueue.
On Jan 18, 2008 11:53 AM, <email@hidden> wrote:
>
> Hmm, I think you need a runloop and you can't use [self updateProgress]
> from background thread (except if it is calling via YAMessageQueue)
>
> :: marcelo.alves
>
>
> On Friday, January 18, 2008, at 02:10AM, "William Zumwalt" <
> email@hidden> wrote:
> >While switching from NSConnection to YAMessageQueue, I ran into some
> >problems and was hoping someone could help. I'm obviously doing something
> >wrong (because my stuff crashes).
> >
> >
> >I have something like this running in a new thread.
> >
> >
> > while (1) {
> >
> >Data *data = [[Data alloc] init];
> >
> >
> > [data set:value];
> >
> >[data set:another];
> >
> >
> > [self updateProgress:data];
> >
> >}
> >
> >
> >And in the base class of the above I do the following ...
> >
> >
> >- (id) initWithObject:(id) mainObject
> >
> >{
> >
> > ...
> >
> >controller = mainObject;
> >
> >clientQueue = [controller messageQueue];
> >
> > messageQueue = [[YAMessageQueue alloc] init];
> >
> > [NSThread detachNewThreadSelector:@selector(threadMain:)
> >
> >toTarget:self withObject:nil];
> >
> >}
> >
> > clientQueue = [controller messageQueue];
> >
> >...
> >
> >[[clientQueue proxyForTarget:controller] updateProgress:data];
> >
> >
> >The above calls a method in my main thread (so that my thread can update
> the
> >gui) ...
> >
> >
> >- (void) updateProgress:(Data *) data
> >
> >{
> >
> >// gui updates ...
> >
> >}
> >
> >
> >I have YAMessageQueue's in the main thread and the new thread so that I
> can
> >communicate both ways.
> >
> >
> >Anything wrong stand out?
> >_______________________________________________
> >
> >Cocoa-dev mailing list (email@hidden)
> >
> >Please do not post admin requests or moderator comments to the list.
> >Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> >Help/Unsubscribe/Update your Subscription:
> >
> >This email sent to email@hidden
> >
> >
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden