RE: [boost] Re: Thread lib (good reason for static)
by Hurd, Matthew other posts by this author
Jun 8 2004 11:01PM messages near this date
[boost] CVS temporarily disabled
|
[boost] Re: Thread lib (good reason for static)
> Behalf Of scott
> Assume use of a technique like the following (think this has been
> presented as "object shim"?);
>
> T &
> anastasia()
> {
> static T *p = new T;
> return *p;
> }
>
> as a means of dealing with global construction issue, i.e. instead
> of expressions like "anastasia.data_member" the usage is
> "anastasia().data_member". Also assume that some of these global
> objects (i.e. shims) deploy mutexes for MT reasons. What happens
> when there is more that one thread running around making calls
> to shims? Instantiation of the global itself becomes an MT issue.
That's what the double-checked locking pattern for singletons is for.
Regards,
Matt Hurd.
_______________
Matt Hurd
+61.2.8226.5029
hurdm@[...].com
Susquehanna
_______________
IMPORTANT: The information contained in this email and/or its attachments is confidential. I
f you are not the intended recipient, please notify the sender immediately by reply and imme
diately delete this message and all its attachments. Any review, use, reproduction, disclos
ure or dissemination of this message or any attachment by an unintended recipient is strictl
y prohibited. Neither this message nor any attachment is intended as or should be construed
as an offer, solicitation or recommendation to buy or sell any security or other financial
instrument. Neither the sender, his or her employer nor any of their respective affiliates
makes any warranties as to the completeness or accuracy of any of the information contained
herein or that this message or any of its attachments is free of viruses.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Hurd, Matthew
Eric Niebler
scott
Alexander Terekhov
|