Re: App modal window and secondary thread
Re: App modal window and secondary thread
- Subject: Re: App modal window and secondary thread
- From: Philippe Sismondi <email@hidden>
- Date: Fri, 19 Mar 2010 17:31:32 -0400
On 2010-03-19, at 4:56 PM, Jens Alfke wrote:
>
> On Mar 19, 2010, at 9:30 AM, Philippe Sismondi wrote:
>
>> while (![NSApp modalWindow]) // probably not thread-safe, but harmless??
>> NSLog(@"polling for modalWindow....");
>
> That's a bad idea, I think. You're making an assumption about NSApplication's implementation (I can think of several ways that this method might be dangerously non-thread-safe), and you're also creating a spin-loop that's going to chew up a lot of CPU while it's running.
>
> I couldn't really follow your argument about why you have to do this. You're already not starting the background thread until the modal window pops up.
>
> —Jens
Jens:
Right - that's exactly my question - I don't know that I have to do this while loop. Is starting the thread after the window pops up enough? Is there anything about *not* waiting for NSApplication to set this window as its modal window that might cause a problem with getting input from the window?
I suspect that your reaction means that the answer is: get rid of the while loop.
Thanks.
Best,
- Phil -_______________________________________________
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