
That was one of the first thoughts that I had. In my included example, the first time I try to lock the mutex is in the class constructor. The class's constructor (where the mutex is locked for the first time) isn't called until after main() is (thought this may lead to a problem if the Test instance was also declared as a static or global). So I would think that any static initialization should be complete by the time the class instance is created. (correct me if I'm wrong here). -Rob Yull -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Frank Mori Hess Sent: Wednesday, May 12, 2010 11:20 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Boost 1.43 - Exception before main() is called -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 12 May 2010, Rob Yull wrote:
I recently upgrade from boost 1.42 to 1.43. All of a sudden, the project I was working on seems to be throwing an exception before main() is called. I was able to reproduce this error in the example below. Using 1.42, it executes just fine. Using 1.43, an exception is thrown before main is reached.
I would guess you are trying to lock the static mutex before its constructor has run. I believe the only guarantee C++ provides wrt static initialization order is that POD types will be initialized before non-POD types. This link might be helpful: http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkvqxysACgkQ5vihyNWuA4WNFACgyGsUNhd4no488HdfTyQ82AVE +bwAn14bax0UTbNMd7KhwO75FIG9mMpn =g847 -----END PGP SIGNATURE----- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users