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: Sat, 20 Mar 2010 07:24:46 -0400
Thanks all. Those suggestions help.
BTW, I inherited the code that does the offending "while" loop. It came from someone's previous attempt to solve exactly one problem: that the secondary thread might finish before the main thread's modal window was even up. I hope I have solved this by starting the thread in the window delegate method windowDidBecomeKey.
Otherwise I have written it so there is no interaction between the threads except for (1) cancellation, (2) the final data that is passed back to the main thread. On cancellation I do use [NSApp abortModal] from the secondary thread, but that is specifically suggested by the Apple documentation. I am now guardedly confident that I have no lurking race conditions etc.
Had I not been compelled to support OS X 10.4 I would have re-written the whole thing to use something better than threads - GCD or NSOperationQueue capabilities are said to be safer, although I have not yet learned them.
I think this one is resolved for me. Thanks again.
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