From: Anthony Williams (anthwil_at_[hidden])
Date: 2002-08-06 09:05:39
> From: Peter Dimov [mailto:pdimov_at_[hidden]]
> Sent: 06 August 2002 14:21
> From: "Pete Becker" <petebecker_at_[hidden]>
> > In C++ we have automatic initialization of static objects,
> so there is
> > less need for once functions.
> We have dynamic initialization of static mutex objects, but
> we do not have
> static initialization of mutex objects. Hello initialization order.
On POSIX, you can statically initialize a mutex, as mutexes are POD.
On Windows, mutexes are always dynamically initialized. However, you can
ensure they are only initialized once by using named mutexes.
I am sure that other platforms have ways of achieving the same aim.
> > Making them more powerful doesn't seem
> > productive, since they will rarely be needed in well-designed code.
> The 'powerful' once function and a statically initialized mutex are
> equivalent in expressive power; I can do either given the other.
Agreed. You can also achieve both given a special-case once function (such
as win32 named mutex creation).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk