Boost logo

Boost :

Subject: [boost] Tools for singleton or monostate or alternative
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-09-24 19:07:57


I would like to kindly ask for advice in finding tools within Boost
collection that could help me to solve my problem.

I'm developing a library (it will be used as dynamic-linked library).
I need to manage a bunch of related values (numbers) globally.
All values are shared across a client process, by its all threads,
so thread-safety is under consideration.
Mostly, a client needs to read the values (defaults) and sometimes, very
rarely, a client needs to re-set the values.

I consider to implement it using singleton or monostate pattern with
thread-safety (and DLL-safety in mind), so actually Tobias Schwinger's
Singleton library [1] would solve this problem well.
However, I would prefer something from the Boost collection - Tobias'
lib hasn't been approved [2], quite pity as Boost lacks of such
tool, IMHO.
Also, I've considered digging out singleton stuff from the
boost::pool::detail, but I'm not convinced to this idea.
I haven't found anything related to monostate patter in Boost.

Would anyone suggest a tool available in Boost that would be
usable to wrap up some basic but robust solution for my problem?

By the way, any plan for update and another round of review of Tobias'


Best regards,

Mateusz Loskot,
Charter Member of OSGeo,

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