|
Boost : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-02-05 17:34:50
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Andrey Semashev
Hi Andrey,
> Tuesday, February 6, 2007, 1:08:25 AM, you wrote:
>
> > Is there interest in having a boost singleton? A preliminary
> > implementation of it could use boost::once. Then all lazy
> > initializations would happen through that interface.
>
> > Just a thought.
>
> I think a generic implementation of a thread-safe singleton is a nice
> idea. I encounter this problem quite often. Although, once-based
> implementation doesn't suit me very well in this case.
What kind of solutions have you come up with for lazily initializing
singletons in a thread-safe manner? What are your reasons for not
preferring a boost::once implementation? I can only think of boost::once
based or platform specific, which scares me, to be frank!
The solution to the problem seems to be a function of hardware and OS
primitives which (I thought) pthread_once/family solve as nicely as
you'd want.
Personally, I'm fairly new to the whole multi-proc scene so I'd really
appreciate some enlightenment!
Sohail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk