Boost logo

Boost :

From: scott (scottw_at_[hidden])
Date: 2004-06-08 20:55:11


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]On Behalf Of Eric Niebler
> Sent: Wednesday, June 09, 2004 11:15 AM
> To: boost_at_[hidden]
> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk