Made it so that singleton deleted at exit could be turned off.
This commit is contained in:
parent
b5dedd0e69
commit
ab2855a130
2 changed files with 6 additions and 0 deletions
|
@ -301,6 +301,7 @@ opts.AddVariables(
|
||||||
('HOST', 'Set the target host for cross compiling', ''),
|
('HOST', 'Set the target host for cross compiling', ''),
|
||||||
('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG),
|
('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG),
|
||||||
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
|
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
|
||||||
|
BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'),
|
||||||
# http://www.scons.org/wiki/GoFastButton
|
# http://www.scons.org/wiki/GoFastButton
|
||||||
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
|
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
|
||||||
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
|
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
|
||||||
|
@ -1706,6 +1707,9 @@ if not preconfigured:
|
||||||
if env['THREADING'] == 'multi':
|
if env['THREADING'] == 'multi':
|
||||||
env.Append(CPPDEFINES = '-DMAPNIK_THREADSAFE')
|
env.Append(CPPDEFINES = '-DMAPNIK_THREADSAFE')
|
||||||
|
|
||||||
|
if env['NO_ATEXIT']:
|
||||||
|
env.Append(CPPDEFINES = '-DMAPNIK_NO_ATEXIT')
|
||||||
|
|
||||||
# Mac OSX (Darwin) special settings
|
# Mac OSX (Darwin) special settings
|
||||||
if env['PLATFORM'] == 'Darwin':
|
if env['PLATFORM'] == 'Darwin':
|
||||||
pthread = ''
|
pthread = ''
|
||||||
|
|
|
@ -119,8 +119,10 @@ template <typename T,
|
||||||
{
|
{
|
||||||
tmp = CreatePolicy<T>::create();
|
tmp = CreatePolicy<T>::create();
|
||||||
pInstance_.store(tmp, std::memory_order_release);
|
pInstance_.store(tmp, std::memory_order_release);
|
||||||
|
#ifndef MAPNIK_NO_ATEXIT
|
||||||
// register destruction
|
// register destruction
|
||||||
std::atexit(&DestroySingleton);
|
std::atexit(&DestroySingleton);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue