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 22:15:27 +1000
OK, I meant I'm not *running* any run loops myself - as per the threading documentation: "For secondary threads, you need to decide whether a run loop is necessary, and if it is, configure and start it yourself. You do not need to start a thread’s run loop in all cases. For example, if you use a thread to perform some long-running and predetermined task, you can probably avoid starting the run loop. Run loops are intended for situations where you want more interactivity with the thread."
1. No
2. No.
3. IIt's stock standard:
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
4. Yes! It does work. Yay!
Regards
Gideon
On 08/12/2010, at 10:02 PM, Dave Keck wrote:
>> FYI, I do not create any run loops explicitly in my application
>
> That's good, because run loops can't be created explicitly. :)
>
>> and can't think of anything I am doing which would create one implicitly.
>
> A run loop is automatically created for every thread that's spawned.
> (I believe this happens lazily though.)
>
> So to summarize, it appears that the instance of NSThread representing
> the main thread has the wrong instance of CFRunLoop. Some thoughts:
>
> 1. Are you using the pthread APIs directly in your code? I recall
> there are several places in the docs that mention certain
> considerations that have to be made to use the pthread and
> Cocoa/NSThread APIs safely together.
>
> 2. Do you have any functions marked __attribute__ ((constructor)) ?
>
> 3. What does your main() function look like?
>
> 4. Does -performSelectorOnMainThread work if you call [NSThread
> mainThread] as the first line in main()?
_______________________________________________
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