Boost logo

Boost :

From: Anthony Williams (anthwil_at_[hidden])
Date: 2002-08-07 07:37:06

> From: Peter Dimov [mailto:pdimov_at_[hidden]]
> Sent: 07 August 2002 12:01
> From: "Anthony Williams" <anthwil_at_[hidden]>
> >
> > However, I'm not sure we want POSIX semantics --- it poses
> an unnecessary
> > burden on the users to have to specify a static initializer
> or call a
> > dynamic init function, it is much preferable to just have
> Mutex() do the
> > Right Thing in all cases.
> Is this possible? Without language/memory architecture
> support, I mean.

See my other post for Win32Mutex and POSIXMutex skeletons that just have a
default constructor.

My point is that you can have thread-safe lazy dynamic initialization, which
works for static objects without causing init-order problems, if you use the
appropriate primitives for each platform. On POSIX, pthread_once provides
such a mechanism; on Win32, Named Mutexes provide such a mechanism. I expect
that other platforms have other primitives, but I would be surprised if
there wasn't _any_ mechanism for this on a particular platform.

However, you are right that it requires some form of platform support, just
not necessarily at the language level.


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