Re: Maintaining *one* singleton over >1 thread
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.