|
Boost : |
From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2002-05-18 15:19:25
Peter Dimov wrote:
[...]
> An entity that is that close to std::auto_ptr<M> (only the deallocator is
> different) should be simpler to build using the framework (which presumably
> can duplicate std::auto_ptr out of the box) - or am I missing something?
Nope, IMO. BTW:
http://groups.google.com/groups?selm=c29b5e33.0201290818.2744d2e6%40posting.google.com
"....
For *mutable*
"lazy-singletons" you need a lock anyway,
so I think that pthread_once does not provide
you much at all in addition to a statically
initialized mutex, which could be used for
both construction and further usage sync.
(static get() method could just "return" a
thread-private auto-"smart_ref/ptr" which
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
would just automatically unlock on its
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
destruction or perhaps even a thread-shareable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
class instance that would provide extra lock/
unlock calls in addition to the singleton's
interface, for example).
...."
regards,
alexander.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk