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 10:56:55 +1000
I have completely commented out all the actions of the method that is executing in the thread. The only things it does are to create an autorelease pool, call a simple performSelectorOnMainThread, and release the pool. There is nothing else going on that I can see, and yet it still fails as per my previous post. If I have multiple performSelectorOnMainThread calls with wait until completed set to YES, they all work the first time the thread is run, and if set to NO, none of them work.
I have taken the threading part of the application and created a little test application with the same flow, and it always works correctly in the test application.
Therefore I would conclude that there is nothing I am doing specifically in the threading portion (which is pretty simple anyway), but something else in the program is upsetting it. I have absolutely no idea where else to look. As far as I can tell, the application is just sitting there idle in the main loop waiting for input, so it should execute straight away. I'm not sure what to read into the fact that the first time I call the performSelectorOnMainThread it works if I say for it to wait for completion, but doesn't work if I say not to.
I tried running the application in Instruments using the thread states tool, and although I couldn't find any documentation on how to interpret the results, what I believe to be the main thread on both my original application and my mini test application seem to have very similar thread state changes, and what I believe to be the main thread is in "On run queue" state in both cases.
I really am at a loss as to where to look next, so would appreciate any suggestions.
To restate the issue, when I run a method in a thread and call performSelectorOnMainThread, it works the first time only if I say to wait for completion, and never works if I say not to wait for completion.
Any ideas?
Thanks
Gideon
_______________________________________________
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