• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: performSelectorOnMainThread fails second time through
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: performSelectorOnMainThread fails second time through
      • From: Dave Keck <email@hidden>
References: 
 >performSelectorOnMainThread fails second time through (From: Gideon King <email@hidden>)
 >Re: performSelectorOnMainThread fails second time through (From: Gideon King <email@hidden>)
 >Re: performSelectorOnMainThread fails second time through (From: Charles Srstka <email@hidden>)
 >Re: performSelectorOnMainThread fails second time through (From: Gideon King <email@hidden>)
 >Re: performSelectorOnMainThread fails second time through (From: Dave Keck <email@hidden>)

  • Prev by Date: Re: performSelectorOnMainThread fails second time through
  • Next by Date: Re: performSelectorOnMainThread fails second time through
  • Previous by thread: Re: performSelectorOnMainThread fails second time through
  • Next by thread: Re: performSelectorOnMainThread fails second time through
  • Index(es):
    • Date
    • Thread