• 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: Maintaining *one* singleton over >1 thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maintaining *one* singleton over >1 thread


  • Subject: Re: Maintaining *one* singleton over >1 thread
  • From: sinclair44 <email@hidden>
  • Date: Tue, 18 Mar 2003 16:14:30 -0500

On 3/18/03 2:50 PM, "Brant Vasilieff" <email@hidden>
wrote:

<snip>
> The instance itself should probably store it's own lock to protect it's
> contents. Jeff's tips for delaying the introduction of the lock until you
> become multithreaded is a good one, however, it's not entirely cost free as it
> still must perform a runtime check for != nil.

I'm using Jeff's tips, and they work fine for my purposes (especially since
I already had +sharedInstance working that way). As for the != nil tests, my
app is guaranteed to be multithreaded by the time the first lock is locked,
unless the user wants an IM bot that doesn't do anything! :p So, the
performance issue is negligible at this point.

Thanks anyways,
sinclair44.
--

-- sinclair44

[self becomeWorldDictator];

- (void)becomeWorldDictator
{
[self coverLegalButt];

[[GeorgeBush principalClass] assassinate:[world currentLeaders]];
[[BinLaden principalClass] terrorize:[world citizens]];
[world setCurrentLeaders:[NSArray arrayWithObject:self]];
}

- (void)coverLegalButt
{
/* The above does not reflect any plans, expressed or implied, real or
imaginative, to kill or assassinate anyone, or to harm anyone in any shape,
way or form. Any relation to actual events is purely coincidental. */
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Maintaining *one* singleton over >1 thread
  • Next by Date: Re: Optimized drawing
  • Previous by thread: Re: Maintaining *one* singleton over >1 thread
  • Next by thread: NSBitmapImageRep TIFFRepresentation crashes :(
  • Index(es):
    • Date
    • Thread