Re: performSelectorOnMainThread fails second time through
Re: performSelectorOnMainThread fails second time through
- Subject: Re: performSelectorOnMainThread fails second time through
- From: Gideon King <email@hidden>
- Date: Wed, 8 Dec 2010 13:11:37 +1000
Umm, as I mentioned, I have stripped back the multithreading part to virtually nothing and taken that code to a test application and it works there, and the rest of the application is 23,000 lines of code, which I can't post.
In my main application, the following still fails (workerThread is an instance variable):
- (void)execute:(AADataForLayoutProcess *)data {
[self cancel];
self.currentDataForLayout = data;
workerThread = [[NSThread alloc] initWithTarget:self selector:@selector(doLayout:) object:self.currentDataForLayout];
[workerThread start];
}
- (void)cancel {
[workerThread cancel];
[workerThread release];
workerThread = nil;
}
- (void)doLayout:(id)data {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self innerExecute:(AADataForLayoutProcess *)data];
[pool release];
}
- (void)innerExecute:(AADataForLayoutProcess *)data {
[self performSelectorOnMainThread:@selector(callback) withObject:nil waitUntilDone:NO];
}
- (void)callback {
NSLog(@"Called back from thread");
}
At this stage, I'm pretty sure that something other than this code is causing the issue, but have no clue where to look.
Regards
Gideon
On 08/12/2010, at 11:29 AM, Dave Keck wrote:
>> Any ideas?
>
> Post your code!
_______________________________________________
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