asserts to catch >static initialization order fiasco<
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@182 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
a5e61478b6
commit
7fa263d636
1 changed files with 5 additions and 2 deletions
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEFAULT_THREADING
|
#ifndef DEFAULT_THREADING
|
||||||
#define DEFAULT_THREADING /**/ ::Loki::SingleThreaded
|
#define DEFAULT_THREADING /**/ ::Loki::SingleThreaded
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,7 +142,7 @@ namespace Loki
|
||||||
CRITICAL_SECTION mtx_;
|
CRITICAL_SECTION mtx_;
|
||||||
bool init_;
|
bool init_;
|
||||||
|
|
||||||
Initializer():init_(false)
|
Initializer():init_(false)
|
||||||
{
|
{
|
||||||
::InitializeCriticalSection(&mtx_);
|
::InitializeCriticalSection(&mtx_);
|
||||||
init_=true;
|
init_=true;
|
||||||
|
@ -166,7 +168,7 @@ namespace Loki
|
||||||
Lock()
|
Lock()
|
||||||
{
|
{
|
||||||
assert(initializer_.init_);
|
assert(initializer_.init_);
|
||||||
::EnterCriticalSection(&initializer_.mtx_);
|
::EnterCriticalSection(&initializer_.mtx_);
|
||||||
}
|
}
|
||||||
explicit Lock(const ClassLevelLockable&)
|
explicit Lock(const ClassLevelLockable&)
|
||||||
{
|
{
|
||||||
|
@ -211,3 +213,4 @@ namespace Loki
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue