Boost logo

Boost :

From: Philip Nash (philip.nash_at_[hidden])
Date: 2001-08-13 12:24:50

> There may be other problems with it - maybe someone else could give some
> > examples - but as I see it a likely obstacle to having a Loki-like
> Singleton
> > accepted into boost is that it relies heavily on atexit(),
> which seems to
> be
> > inconsistently implemented across compilers.
> > Does anyone have any workarounds for that?
> how about your own atexit() impl based on top
> of yet another thread-safe static local singleton?
> it could also help to solve the problem of
> "Implementation Limits: The implementation shall
> support the registration of at least 32 functions."

Hmm, I'm not sure about static, since we are bound to get caught up in
scoping issues between translation units again...
Have you tried anything like this, or was it just a suggestion "off the top
of your head"?

But if the "master" singleton registered itself with atexit (having been
created on first call by an application singleton to register its
terminator), then that could work...
This could also provide other advanced features such as longevity, rather
than the logic being coded into the singleton. By abstracting atexit this
way we are no longer limited to mere function pointers as terminators
either. Functors would allow the traditional terminators, or other functors,
or even member functions. But for supporting singletons in most cases all
you need is to register a pointer to the object itself so that it can be

There is definitely something in this!



Boost list run by bdawes at, gregod at, cpdaniel at, john at