
3 Mar
2009
3 Mar
'09
4:54 p.m.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 03 March 2009, Oliver Kowalke wrote:
Hi, I need a function 'get_default_X()' returning a reference to a singleton in a multithreaded env. I choosed Scott Meyers singleton pattern (static local) together with boost::call_once(). My this be a reasonable, threadsafe implementation?
I don't think so. Your once_flag is a local variable in Y's constructor, so I don't see that the call_once accomplishes anything. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmtYNcACgkQ5vihyNWuA4UJyACfciR5l1vbwg7wMPUISDIQUhoN AfYAoLbHeovjJsaKzRuY0lYSmF5l0E1F =E/Pf -----END PGP SIGNATURE-----