• 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: Derrick Bass <email@hidden>
  • Date: Wed, 22 Mar 2006 18:51:44 -0600


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

_______________________________________________
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


  • Follow-Ups:
    • Re: awakeFromNib vs appdidfinishlaunching
      • From: John Stiles <email@hidden>
References: 
 >Fwd: awakeFromNib vs appdidfinishlaunching (From: John Stiles <email@hidden>)

  • Prev by Date: NSImageView in IB
  • Next by Date: Confused on releasing bindings in doc-based apps
  • Previous by thread: Fwd: awakeFromNib vs appdidfinishlaunching
  • Next by thread: Re: awakeFromNib vs appdidfinishlaunching
  • Index(es):
    • Date
    • Thread