Boost logo

Boost Users :

Subject: Re: [Boost-users] Thread-safe singleton pattern
From: Ingolf Steinbach (ingolf.steinbach_at_[hidden])
Date: 2010-01-26 15:04:22


Hi Andrew.

2010/1/26 Andrew Chinkoff <achinkoff_at_[hidden]>:
> Does Boost community think that boost::Singleton is convenient solution?

After a quick glance at your suggested implementation, I see some issues:
1. "__SINGLETON_HPP__" is reserved
2. the same for "____DOOMED_SINGLETON_MUST_NOT_BE_ARRAY____"
3. use 0 rather than NULL
4. you might want to read
http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf (on double
checked locking)
5. http://www.boost.org/doc/libs/1_41_0/doc/html/thread/synchronization.html#thread.synchronization.once
might help you

Kind regards
Ingolf


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net