RE: [boost] Re: Thread lib (good reason for static)
by scott other posts by this author
Jun 9 2004 1:55AM messages near this date
[boost] Re: Thread lib (good reason for static)
|
[boost] Re: Thread lib (good reason for static)
> -----Original Message-----
> From: boost-bounces@[...].org
> [mailto:boost-bounces@[...].org]On Behalf Of Eric Niebler
> Sent: Wednesday, June 09, 2004 11:15 AM
> To: boost@[...].org
> Subject: [boost] Re: Thread lib (good reason for static)
[snip]
> >
> > 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
>
Yeah! Of course I have to admit I'd never heard of
DCLP before ;-)
Read the notes quickly and they are very nicely presented.
The actual bug that I created was related to the mutex
controlling instantiation. Essentially if there is a
multi-access issue around instantiation, how does adding
a mutex make it better, i.e. how does the mutex get
constructed (safely)?
In the notes this is the following line on page 8. I'm
assuming "args" is a constructed mutex;
Lock L( args); // Acquire mutex or other lock
While this is becoming something of a tangent maybe
it qualifies as an example of why globals creating
threads in ctors is a bear?
Cheers,
Scott
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Hurd, Matthew
Eric Niebler
scott
Alexander Terekhov
|