• 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: awakeFromNib vs appdidfinishlaunching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: awakeFromNib vs appdidfinishlaunching


  • Subject: Re: awakeFromNib vs appdidfinishlaunching
  • From: John Stiles <email@hidden>
  • Date: Wed, 22 Mar 2006 17:29:45 -0800

On Mar 22, 2006, at 4:51 PM, Derrick Bass wrote:


I think it's not difficult to devise a scenario where no cleanup handler could possibly undo the damage perfectly. Here's one example--what if you try to "cancel" a pthread that's in the middle of malloc'ing a block, and the heap is currently in some jumbled state? Is malloc supposed to register a cleanup handler on every thread to roll back the partially-completed allocation? Even if you argue that it should work that way, it doesn't currently do so, and I suspect it would be extremely difficult to make this work 100% of the time.

We're getting a little off-topic here, but the pthread designers anticipated such problems and provided solutions. It is possible to set a thread's cancelability to state to deferred during such dangerous activities, and therefore make them atomic (a cancelation request will not be acted upon until after the state is set back to normal). As I said, I've never tried this approach, but I'm pretty sure that it is hard to get it right (especially in Objective-C, where even a simple method call could allocate memory from the heap). For my part, I read the pthread docs, despaired for a while, and then put my heavy computations in a separate process accessible via Distributed Objects.

Anyway, for those braver than I, see here: <http:// davinci01.man.ac.uk/aix433/aixprggd/genprogc/term_threads.htm>.

Derrick

I couldn't imagine retrofitting existing code with this solution without taking an extremely granular approach, but I must admit I never knew that ;) Good info.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Fwd: awakeFromNib vs appdidfinishlaunching (From: John Stiles <email@hidden>)
 >Re: awakeFromNib vs appdidfinishlaunching (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: Useless side remark...
  • Next by Date: NSTimer fires after invalidated - why?
  • Previous by thread: Re: awakeFromNib vs appdidfinishlaunching
  • Next by thread: Create a file and the path....
  • Index(es):
    • Date
    • Thread