[boost] Re: Thread lib (good reason for static)
by Eric Niebler other posts by this author
Jun 8 2004 11:15PM messages near this date
RE: [boost] Re: Thread lib (good reason for static)
|
RE: [boost] Re: Thread lib (good reason for static)
Hurd, Matthew wrote:
> >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.
No, the double-checked locking pattern is only good as the subject of
talks describing why it's not good for anything.
http://www.nwcpp.org/Downloads/2004/DCLP_notes.pdf
--
Eric Niebler
Boost Consulting
www.boost-consulting.com
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Hurd, Matthew
Eric Niebler
scott
Alexander Terekhov
|