Tools for singleton or monostate or alternative

Hi, 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' library? [1] http://torjo.com/tobias/index.html [2] http://lists.boost.org/boost-announce/2008/01/0171.php Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org

You might look at the lock-free singleton in the serialization library. Robert Ramey Mateusz Loskot wrote:
Hi,
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' library?
[1] http://torjo.com/tobias/index.html [2] http://lists.boost.org/boost-announce/2008/01/0171.php
Best regards,

Robert Ramey wrote:
You might look at the lock-free singleton in the serialization library.
Thanks for the suggestion. I'll take a look. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
participants (2)
-
Mateusz Loskot
-
Robert Ramey